Vim Syntax highlighting

Source: Internet
Author: User

1. Location of configuration files
Under directory/etc/, there is a file named VIMRC, which is a public vim configuration file in the system and is valid for all users. In each user's home directory, you can create a private configuration file, named: ". VIMRC ". For example, under the/root directory, there is usually already one. VIMRC file.
If you do not know the location of the configuration file and script, you can use the command in VIM: Scriptnames, the following path will be displayed
/etcimrc
/usrimim72/syntax/syntax.vim
/usrimim72/syntax/synload.vim
/usrimim72/syntax/syncolor.vim
/usrimim72/filetype.vim
/usrimim72/ftplugin.vim
/home/kdj/.vimrc
...
If you do not know the search location for the Vim configuration file, enter: version, which will be displayed
System VIMRC File: "/ETCIMRC"
User VIMRC file: "$HOME/.VIMRC"
User EXRC file: "$HOME/.EXRC"
$VIM preset value: "/usrim"


2. Set syntax highlighting
1) Open VIMRC and add the following statement to make syntax highlighting:
Syntax on
2) If the syntax is not highlighted at this point, then add the following statement in the profile file in the/etc directory:
Export Term=xterm-color

3. Set the Windows-style C + + Auto Indent (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 in the indent to 4
Set shiftwidth=4
3) Set auto indent: The indent value of each line is equal to the previous line; Use Noautoindent to cancel the setting:
Set Autoindent
4) Set the automatic indent mode using C/C language:
Set Cindent
5) Set the specific indentation of the C/C language (for example in 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 settings cursor display
7) Finally, if you do not have the following statement, add it:
If &term== "Xterm"
Set T_co=8
Set T_SB=^[[4%DM
Set T_SF=^[[3%DM
endif

Vim Syntax highlighting

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.