Vim configuration highlighting and automatic indentation

Source: Internet
Author: User
1, the location of the configuration fileUnder the directory/etc/, there is a name named VIMRCFile, which is the public vim profile in the system and is valid for all users. In each user's home directory, you can create a private profile of your own, named: " . VIMRC”。 For example, under the/root directory, there is usually a . VIMRCFile. If you do not know the location of the configuration file and script, you can use the command in Vim: Scriptnames, which displays the following path/etc/vimrc/usr/share/vim/vim72/syntax/syntax.vim/usr/share/vim/ Vim72/syntax/synload.vim/usr/share/vim/vim72/syntax/syncolor.vim/usr/share/vim/vim72/filetype.vim/usr/share/ VIM/VIM72/FTPLUGIN.VIM/HOME/KDJ/.VIMRC ... If you do not know the location of the Vim configuration file Search, enter: Version to display the system VIMRC file: "/ETC/VIMRC" User vimrc file: "$HOME/.VIMRC user exrc file:" $HOME/.exrc "$VIM preset:" /usr/share/vim "I just copy the/ETC/VIMRC file to the user you want to set, and then use the MV command to name the VIMRC after the copy. VIMRC then add the following related settings 2. Set syntax highlighting1 Open VIMRC, add the following statement to make syntax highlighting: syntax on 2) if the syntax is not highlighted at this time, add the following statement to the profile file in the/ETC directory: Export Term=xterm-color 3. Set up windows 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 indented to 4 set shiftwidth=4 3) set automatic indentation: That is, the indentation value of each row is equal to the previous line; use Noautoindent to cancel Set: Set Autoindent 4 sets the automatic indent mode for C/C + + languages: Set Cindent 5 sets the specific indentation for the 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 sets roler setting cursor display
7 Finally, if you don't have the following statement, add it: 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.