Nginx configuration file Vim syntax highlighting and indenting

Source: Internet
Author: User

Syntax highlighting settings

The Linux system under the Vim or VI editor defaults to nginx syntax highlighting.

You need to manually configure it yourself.

1. Download VI syntax highlight configuration to ~/.vim/syntax, if not present, create the directory

The code is as follows

CD ~/.vim/syntax

wget Http://www.vim.org/scripts/download_script.php?src_id=14376-O Nginx.vim

2. Add configuration ~/.vim/filetype.vim to the last line and create if the file does not exist

The code is as follows

VI ~/.vim/filetype.vim

Add the following content:

The code is as follows

Au bufread,bufnewfile/usr/local/nginx/* set Ft=nginx

Where the red path is your nginx.conf file path

Auto Indent

Set Windows-style C + + automatic indentation (add the following set statement to VIMRC)

1) Set (soft) tab width to 4:

Set tabstop=4

Set softtabstop=4

2) Set the number of spaces indented to 4

Set shiftwidth=4

3 Set Auto indent: That is, the indentation value of each row is equal to the previous line; Use Noautoindent to cancel the setting:

Set Autoindent

4 to set up the automatic indent mode using C + + language:

Set Cindent

5 to set the specific indentation method for A/C + + language (for example, my Windows style):

Set Cinoptions={0,1s,t0,n-2,p2s, (03s,=.5s,>1s,=1s,:1s

6 If you want to display the line number of the text on the left, you can use the following statement:

Set Nu

Set Roler setting cursor display

7 Finally, if you don't have the following statement, add it:

  code is as follows &nbs P;
if &term== "xterm"
Set t_co=8
      ;        set T_SB=^[[4%DM
set T_SF=^[[3%DM
 
endif
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.