Highlight and indent the vim Syntax in the nginx configuration file

Source: Internet
Author: User

Syntax highlighting settings

In linux, the vim or vi editor does not highlight nginx Syntax by default.

Manual configuration is required.

1. Download vi syntax highlighting configuration ~ /. Vim/syntax. This directory is created if it does not exist.

The code is as follows: Copy code

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. If the file does not exist, create

The code is as follows: Copy code

Vi ~ /. Vim/filetype. vim

Add the following content:

The code is as follows: Copy code

Au BufRead, BufNewFile/usr/local/nginx/* set ft = nginx

The red path is your nginx. conf file path.

Auto Indent

Set Windows C/C ++ Auto Indent (add the following set statement to vimrc)
1) set the (soft) tab width to 4:
                      
Set tabstop = 4
Set softtabstop = 4
2) set the number of spaces for indentation to 4.
Set shiftwidth = 4
3) set automatic indent: that is, the indent value of each line is equal to that of the previous line; use noautoindent to cancel the settings:
Set autoindent
4) set the automatic indent mode in C/C ++ language:
Set cindent
5) set the specific indent mode for C/C ++ language (taking my windows style as an example ):
Set cinoptions = {s, t0, n-2, p2s, (03 s, =. 5 s,> 1 s, = 1 s,: 1 s
6) to display the line number of the text on the left, use the following statement:
Set nu
Set roler set cursor display

7) add the following statement if it does not exist:

The code is as follows: Copy code
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.