ls
, grep
, etc. by adding flags to show colours in the output. I have set my PS1
in such a way that the prompt is in a different colour. It makes it easy for me to see where the prompt ends and the command starts. When I heard about fish and that it does syntax highlighting, I was tempted to switch to it. But I couldn’t because it didn’t do certain things I needed. (I don’t remember the details now.) Soon after that I found out that it’s very simple to add syntax highlighting to zsh!All you have to do is download the code from zsh-syntax-highlighting project and “source” it in your
.zshrc
. But I wasn’t happy with their defaults. By default this script underlines path names, but I hate underlining because it makes text less readable. I also didn’t like their choice of blue colour for globs. On my black terminal, blue is hardly readable. Customising the formatting was easy too; I only had to change the value of a variable. This is what my .zshrc has now, and syntax highlighting works like a charm.source ~/dload/src/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
ZSH_HIGHLIGHT_STYLES[globbing]='fg=yellow'
ZSH_HIGHLIGHT_STYLES[path]='bold'
You can find the list of different syntax highlighting options in this file.
Thanks man! I found out about zsh-syntax-highlighting through your site :)
ReplyDelete