$ wget https://www.vim.org/scripts/download_script.php?src_id=19394 -O nginx.vim
$ mv nginx.vim /usr/share/vim/vim74/syntax
$ mv nginx.vim ~/.vim/syntax/ // 单用户目录
$ vim /usr/share/vim/vim74/filetype.vim
$ vim ~/.vim/filetype.vim
au BufRead,BufNewFile /etc/nginx/*,/usr/local/nginx/conf/* if &ft == '' | setfiletype nginx | endif
根据自己安装的 Nginx 目录修改配置
$ vim nginxSyntaxHightlight.sh
#!/bin/bash
mkdir -p ~/.vim/syntax && cd ~/.vim/syntax
wget http://www.vim.org/scripts/download_script.php?src_id=19394 -O nginx.vim >/dev/null
echo "au BufRead,BufNewFile /usr/local/nginx/conf/* set ft=nginx" > ~/.vim/filetype.vim
# 其中路径/usr/local/nginx/conf/* 为你的 nginx.conf 文件路径
$ sh nginxSyntaxHightlight.sh