Nginx syntax for vim

Disclaimer _This post is not mine. It is only copied here as a backup. All the credit go to the creators of the content. You can find the original post here http://zduck.com/2012/syntax-highlighting-for-nginx-in-vim/ _

Thanks to Evan Miller, adding VIM syntax highlighting for Nginx config files is a breeze.

Create a folder for your VIM syntax files.

mkdir -p ~/.vim/syntax/

Download the syntax highlighting plugin.

curl http://www.vim.org/scripts/download_script.php?src_id=19394 -o ~/.vim/syntax/nginx.vim

Add it to VIM’s file type definitions. Make sure to adjust the path to your Nginx installation if you need to.

echo "au BufRead,BufNewFile /etc/nginx/conf/* set ft=nginx" >> ~/.vim/filetype.vim

Now enable syntax highlighting in your .vimrc file.

echo "syntax enable" >> ~/.vimrc

That’s it. Now you’ll have nice colors when you edit your Nginx configs with VIM!