1. Location of configuration FilesUnder 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, a. vimrc file is usually already present. 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/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, 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 up, and then use the MV command to name the VIMRC after the copy. VIMRC and then add the following related settings
2. Set syntax highlighting1) Open VIMRC, add the following statement to make syntax highlighting: syntax on2) If the syntax is not highlighted at this point, 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=4set softtabstop=42) set indent to 4set shiftwidth=43) Set auto indent: That is, the indent value of each line is equal to the previous line; using Noautoindent Cancel settings: Set AUTOINDENT4) sets the auto-indent method using the C + + language: Set cindent
5) Set the specific indentation for the C + + language (for example in Windows style): Set Cinoptions={0,1s,t0,n-2,p2s, (03S,=.5S,>1S,=1S,:1S6) 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: if &term== "xterm" set T_co=8set t_sb=^[[4%dmset t_sf=^[[3%dmendif
The indent and highlight settings in vim