Vim syntax highlighting for NGINX

How to install

When you are editing an nginx config file, you don't automatically get vim syntax highlighting. BUT, you can download a plugin to fix that! YAY!!

Go to VIM Scripts to download the latest version.

Do the following steps:

Go to your home directory

cd ~

Then download the script. (You should change the link below to the most updated version found on the VIM Scripts site)

wget -O nginx.vim\?src_id\=19394


Then make a syntax directory for vim, if you don't already have it.

mkdir -p ~/.vim/syntax

Then move the vim file into the correct directory:

mv nginx.vim ~/.vim/syntax/

Then create your vim filetype file and link the new syntax:

vim ~/.vim/filetype.vim

and paste in there:

au BufRead,BufNewFile /etc/nginx/*,/usr/local/nginx/conf/* if &ft == '' | setfiletype nginx | endif

You should adjust the path to your nginx config, if it is different than /etc/nginx/.

Now you should have color syntax highlighting for NGINX!