# zsh syntax highlighting



## NapoleonWils0n (May 16, 2019)

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


```
# 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






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





Add the following code to your ~/.zshrc file


```
# 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


```
source ~/.zshrc
```


----------



## rigoletto@ (May 16, 2019)

textproc/zsh-autosuggestions is another good one.


----------



## tedbell (May 16, 2019)

And also zsh-history-substring-search


----------



## mfaridi (May 16, 2019)

Using these links help you








						Shell - Share your .zshrc file
					

I like the way how tcsh works, but it is outdated a little bit (only 1 update since 2012), also some nice features are available in zsh, like suggesting flags and other completions for cli and not only cli apps… But some of its features are distracting and annoying IMHO. I didn't find any...




					forums.freebsd.org
				











						GitHub - zsh-users/zsh-syntax-highlighting: Fish shell like syntax highlighting for Zsh.
					

Fish shell like syntax highlighting for Zsh. Contribute to zsh-users/zsh-syntax-highlighting development by creating an account on GitHub.




					github.com


----------



## aht0 (May 20, 2019)

csh coloring-options do not satisfy you? I have .cshrc file converting csh shell bash-lookalike from Linux Mint.


----------

