zsh syntax highlighting

Install the zsh shell and zsh syntax highlighting
This will enable Fish shell like syntax highlighting for Zsh

Bash:
# pkg install zsh zsh-syntax-highlighting

If you type ls - and then tab zsh will show you all the options for the ls command,
and colour code the output to make it easier to scan

6494


It will also colour rm -rf with a bright red background and white text,
which make the text stand out in the terminal and is very useful in preventing accidental deletion of important files

6495


Add the following code to your ~/.zshrc file

Bash:
# syntax highlighting
source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
ZSH_HIGHLIGHT_STYLES[suffix-alias]=fg=cyan,underline
ZSH_HIGHLIGHT_STYLES[precommand]=fg=cyan,underline
ZSH_HIGHLIGHT_STYLES[arg0]=fg=cyan
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern cursor)
ZSH_HIGHLIGHT_PATTERNS=('rm -rf *' 'fg=white,bold,bg=red')

You may need to source your ~/.zshrc file to pick up the changes

Bash:
source ~/.zshrc
 
Using these links help you
 
csh coloring-options do not satisfy you? I have .cshrc file converting csh shell bash-lookalike from Linux Mint.
 
Back
Top