NGINX配置文件高亮显示

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=14376 -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!

>vim /etc/nginx/conf/nginx.conf

Screenshot of VIM with syntax highlighting in an Nginx config file.

原文地址:https://www.cnblogs.com/liqiu/p/2830823.html