Your most productive terminal with Oh My Zsh and spaceship

edsonjuniornarvaes

Edson Junior de Andrade

Posted on June 17, 2022

Your most productive terminal with Oh My Zsh and spaceship

Install Zsh

sudo apt-get install zsh
Enter fullscreen mode Exit fullscreen mode

Clone the zsh

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
Enter fullscreen mode Exit fullscreen mode

Install Spaceship

git clone https://github.com/denysdovhan/spaceship-prompt.git "$ZSH_CUSTOM/themes/spaceship-prompt"
Enter fullscreen mode Exit fullscreen mode

Create a symbolic link

ln -s "$ZSH_CUSTOM/themes/spaceship-prompt/spaceship.zsh-theme" "$ZSH_CUSTOM/themes/spaceship.zsh-theme"
Enter fullscreen mode Exit fullscreen mode

Set Spaceship Theme, enter in ~/.zshrc

sudo nano ~/.zshrc
Enter fullscreen mode Exit fullscreen mode

Within ~/.zshrc, find the line

ZSH_THEME and change it to > ZSH_THEME="spaceship"
Enter fullscreen mode Exit fullscreen mode

Configure Spaceship

At the end of the ~/.zshrc file I add the following content

SPACESHIP_PROMPT_ORDER=(
  user          # Username section
  dir           # Current directory section
  host          # Hostname section
  git           # Git section (git_branch + git_status)
  hg            # Mercurial section (hg_branch  + hg_status)
  exec_time     # Execution time
  line_sep      # Line break
  jobs          # Background jobs indicator
  exit_code     # Exit code section
  char          # Prompt character
)
SPACESHIP_USER_SHOW=always
SPACESHIP_PROMPT_ADD_NEWLINE=false
SPACESHIP_CHAR_SYMBOL="❯"
SPACESHIP_CHAR_SUFFIX=" "
Enter fullscreen mode Exit fullscreen mode

Plugins

To configure a plugin, we also have to edit the ~/.zshrc file by adding or removing the plugin names in the variable array:

plugins=(git)
Enter fullscreen mode Exit fullscreen mode

zsh-history-substring-search

  • Includes history features
git clone https://github.com/zsh-users/zsh-history-substring-search.git ~/.oh-my-zsh/custom/plugins/zsh-history-substring-search
Enter fullscreen mode Exit fullscreen mode

zsh-syntax-highlighting

  • Highlight the command pack as they are typed
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting
Enter fullscreen mode Exit fullscreen mode

zsh-autosuggestions

  • Suggest commands based on history based on your typing
git clone https://github.com/zsh-users/zsh-autosuggestions.git ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
Enter fullscreen mode Exit fullscreen mode

fzf locator

  • ctrl+t will allow you to search any file/directory on the system
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf && ~/.fzf/install
Enter fullscreen mode Exit fullscreen mode
💖 💪 🙅 🚩
edsonjuniornarvaes
Edson Junior de Andrade

Posted on June 17, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related