Linux, plaintext & minimalism
August 20, 2018

Automatically disable syntax highlighting in Vim when editing the zsh buffer

I often edit my zsh buffer in Vim and one of the reasons for it is to have access to spell check (using GNU Aspell).

Spell check is a very nice feature to have when I do things like posting an update to Mastodon via the command-line client toot. But one annoying thing with it is that the syntax highlighting feature in Vim overrides the misspelled words, making it impossible to spot potentially misspelled words.

Vim with syntax highlighting enable and disabled for the zsh buffer Vim with syntax highlighting enabled and disabled for the zsh buffer.

Thankfully there’s an easy way of automatically disabling the syntax highlighting feature in Vim when editing the zsh buffer, you just add one tiny line to your Vim configuration:

autocmd FileType zsh set syntax=off

Save and reload your configuration and you’re set.

Tags: zsh | Vim


I don't have a commenting system simply because I haven't found a solution that I like. If you want to leave any feedback and/or have any questions feel free to contact me either via e-mail, the fediverse, by XMPP or by IRC (I'm Hund at freenode.net).