Download nginx.vim
Here we take the Linux system as an example, other systems are similar.
Switch to the vim syntax configuration directory and download the nginx syntax file.
It should be noted that vim74 in the path needs to correspond to the vim version number installed on the machine.
cd /usr/share/vim/vim74/syntax && wget -o nginx.vim https://vim.sourceforge.io/scripts/download_script.php?src_id=19394
Configure filetype.vim
Edit the filetype.vim file to register the nginx syntax file
vim /usr/share/vim/vim74/filetype.vim
Add the following code to the file, Among them, nginx_path needs to be replaced with the nginx configuration file directory on the machine, such as /etc/nginx/*:
" nginx au bufnewfile,bufread nginx_path setf nginx
Effect overview
Before configuration
After configuration
The above is the detailed content of How to highlight NGINX configuration files in VIM. For more information, please follow other related articles on the PHP Chinese website!