Sometimes flashy, sometimes plain -iterm2

The introduction

The theme of oh-my-zsh was p9K, now it’s P10K, the font was powerline, now it’s nerd…

Changes are so fast and articles need to be updated in real time…

Take a look at my terminal: sometimes flashy, sometimes unpretentious

Tools to prepare

  1. iterm2
  2. Iterm2 Color: iterm2-color-schemes -nord
  3. Nerd-font: nerd-font
  4. ZSH (delivered with Mac, no installation required)
  5. Oh-My-Zsh
  6. Oh – My – Zsh powerlevel9k theme
  7. 10 k address

Without further ado, let’s get started…

Start the installation

Install iTerm2

  1. Go to the official website to download, install, or usebrew install --cask iterm2
  2. Match theme Color: iterm2 Color: iterm2-color-schemes -nord

  1. After downloading, we open iterm2

  1. Import the file you just downloaded and select JustnordThe theme… Of course, the same is true for other subjects

The font

Nerd is one of the most popular fonts that supports ICONS and emoticons.

Nerd warehouse: nerd-font

Installation method:

brew tap homebrew/cask-fonts
brew install --cask font-hack-nerd-font
Copy the code

View the font you just installed:

cd ~/Library/Fonts
ls
Copy the code

Iterm2 preferences ->profile->Text->Font->Change Font To Change the Font, select:

ZSH installation:

  • ZSH is already shipped with Mac, so no additional installation is required. Run cat /etc/shells to check whether ZSH is installed. If /bin/zsh is displayed, ZSH is installed.
  • Echo $Shell to check what the current Shell is. If it is not /bin/zsh, run the following command to change the iTerm2 default Shell to ZSH:
  • chsh -s /bin/zsh

The installationOh-My-Zsh:

sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
Copy the code

Install the ZSH theme

Oh-my-zsh PowerLevel9k

Clone the repository to oh-my-zsh user – defined theme directory:

git clone https://github.com/bhilburn/powerlevel9k.git ~/.oh-my-zsh/custom/themes/powerlevel9k
Copy the code

Oh – My – Zsh 10 k address

Step 1: Clone the warehouse again

git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
Copy the code

The second step:

Set ZSH_THEME="powerlevel10k/powerlevel10k" in ~/.zshrc.
Copy the code

Step 3:

Add in the.zshrc file

POWERLEVEL9K_MODE='nerdfont-complete'
Copy the code

Step 4:

Continue to add to the.zshrc file:

# ==== Theme Settings ====
# PowerLevel9k

#Terminal color
export TERM="xterm-256color"

#User name Note the previous DEFALUT_USER comment
POWERLEVEL9K_CONTEXT_TEMPLATE="dream"

#Set the oh-my-zsh powerLevel9k theme to show the left element
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context dir rbenv vcs)
#Set the element to the right of the oh-my-zsh powerLevel9k theme to display
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(virtualenv status root_indicator background_jobs time)
#A new line displays the command (recommended! Extremely convenient)
POWERLEVEL9K_PROMPT_ON_NEWLINE=true
#The status bar on the right is on the same line as the command
POWERLEVEL9K_RPROMPT_ON_NEWLINE=true
#Shortening directory levels
POWERLEVEL9K_SHORTEN_DIR_LENGTH=1
#Directory shortening policy: Hides the words in the middle of the upper-layer directory
#POWERLEVEL9K_SHORTEN_STRATEGY="truncate_middle"
#POWERLEVE9K_SHORTEN_STRATEGY="truncate_from_right"
#Add connection up and down arrow for easier viewingPOWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX = "↱" POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX = "↳"#The new command is one line separated from the previous command
#POWERLEVEL9K_PROMPT_ADD_NEWLINE=true
#Color specification of Git repository state
POWERLEVEL9K_VCS_CLEAN_FOREGROUND='blue'
POWERLEVEL9K_VCS_CLEAN_BACKGROUND='black'
POWERLEVEL9K_VCS_UNTRACKED_FOREGROUND='yellow'
POWERLEVEL9K_VCS_UNTRACKED_BACKGROUND='black'
POWERLEVEL9K_VCS_MODIFIED_FOREGROUND='red'
POWERLEVEL9K_VCS_MODIFIED_BACKGROUND='black'
Copy the code

The syntax of the ZSH command is high

  1. ZSH -syntax-highlighting command has syntax highlighting

Terminal: git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

  1. Zsh-autosuggestions code completion plug-in

Terminal: git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

  1. Continue to add to.zshrc:
# Add wisely, as too many plugins slow down shell startup.
plugins=(
   git
   extract
   z
   zsh-syntax-highlighting
   zsh-autosuggestions
 )
Copy the code
  • git: Oh-my-zsh is enabled by default.gitSome of the states can be in the terminal has a corresponding prompt…
  • extract: General-purpose decompression plug-in, can decompress any suffix compressed file, use the method is very simple:_x File name _;
  • z: very intelligent directory jump plug-in, can record before CD which directory, and then fuzzy matching jump, do not need to enter the full path to jump, use method:_z dir_pattern_
  • Pay attention tosource .zshrc

summary

Software installation and configuration is not difficult, the key is how to use it to increase our efficiency…

reference

  • Sometimes flashy, sometimes plain -iterm2