1. 程式人生 > >Nginx配置文件的高亮顯示設置

Nginx配置文件的高亮顯示設置

font str 16px pan get 其中 size http 路徑

linux系統下vim或者vi編輯器默認是沒有對nginx的語法高亮設置。

1.下載vi語法高亮配置到 ~/.vim/syntax,如果不存在則創建該目錄,cd ~/.vim/syntax

wget http://www.vim.org/scripts/download_script.php?src_id=19394 -O nginx.vim

2.增加配置~/.vim/filetype.vim 到最後一行,如果文件不存在則創建,vi ~/.vim/filetype.vim

[root@chat-otc .vim]# cat filetype.vim 
au BufRead,BufNewFile /application/nginx-1.12.2/conf/* set ft=nginx

其中/application/nginx-1.12.2/conf/* 為你的nginx.conf文件路徑,也可以寫成/application/nginx-1.12.2/*

3. 整體目錄

[root@hotcoin-chat-otc ~]# ll /root/.vim/
total 8
-rw-r--r-- 1 root root   68 Dec 17 18:12 filetype.vim
drwxr-xr-x 2 root root 4096 Feb  5 10:51 syntax
[root@hotcoin-chat-otc ~]# ll /root/.vim/syntax/
total 32
-rw-r--r-- 1 root root 29541 Dec 17 18:11 nginx.vim

Nginx配置文件的高亮顯示設置