1: New Profile
In a terminal in: vi ~ / .vimrc
(Vimrc is the vim configuration file, it will automatically load the configuration file each time you open vim)
2: code configuration is as follows: can be copied directly to the inside and then save on the line
set ai "auto indent the new row with the row in front of the holding - auto-spacing consistent
set aw" automatic writing, into the shell or used: when n edit another file, the current buffer is written to
set flash "in the error at blinking but not crying (default)
the SET ic "in the query pattern matching and suddenly bribe case
the SET NU
the SET number the" left of the screen to display line numbers
when set showmatch "display matching parentheses, when you type"] ""), "high highlight matching brackets
set showmode "in text input mode when the mode indicator is highlighted in the button bar
set showcmd" display instruction currently executed in the status bar, unfinished instruction fragment also displayed
set warn "the text after the new modified, leaving the shell present a display system (default)
sET WS "when searching for the end of file, such as file header wraps around to continue the search
set wrap" long lines displayed automatically wrap
colorscheme evening "is set as the background night mode
filetype plugi n on "automatically recognize the file type, automatic matching corresponding to the" file type Plugin.
set autoindent "set auto indent: the indent values in each row is equal to the previous line; unset used noautoindent
set cindent" to C / C ++ model indentation
set noignorecase "default case-insensitive
set ruler" open bar gauge
set scrolloff = 5 "from the window, the cursor is set lower and upper bounds 5 rows window automatically scroll
set shiftwidth = 4" width setting movement >> and << command. 4
sET = softtabstop. 4 "that can press the backspace key to delete a out of four spaces, less than four time remove all the remaining spaces)
sET = TabStop. 4 "is set to the length of tab. 4
sET wrap" wrap display
syntax enable
syntax ON "automatic syntax highlighting
set autoindent" self-aligning "
sET smartindent "smart align"
SET = A mouse "using the mouse"
inoremap (() <the ESC> I "brackets automatically filled"
inoremap [ []<ESC>i
inoremap { {}<ESC>i
inoremap < <><ESC>i
3. Exit Save, and:
source ~/vimrc
Then you can use.
Code Example 4
" Close vim principle of consistency the SET nocompatible " display line numbers the SET Number The " set during editing cursor to the lower right corner displays information ranks the SET ruler A " display command is entered in the status bar at the SET showcmd " set the number of records the history of the SET History = 1000 " set to cancel the backup files generated temporary ban set nobackup set noswapfile " match the settings mode set showmatch " setting C / C ++ mode automatically align set autoindent set cindent " turn on syntax highlighting syntax enable syntax ON " to specify the color scheme for the 256-color set= t_Co 256 " ignoring case set search SET ignorecase " configuration works backspace SET backspace = indent, EOL, Start " settings may be used in vim mouse SET Mouse = A " setting tab width SET TabStop = . 4 " automatic alignment settings the number of spaces sET shiftwidth = . 4 " may be deleted when the four spaces provided backspace key sET smarttab is sET softtabstop = . 4 " will be automatically converted to space the tab key sET expandtab " set the encoding sET encoding = UTF- . 8 " sequentially attempts to automatically determine the encoding the following coding setUCS-BOM = fileencodings, UTF- 8 , cp936, GB18030, big5, EUC-jp, EUC- KR, latin1 " detect the file type filetype ON " to take a different indentation for different document filetype indent ON " allows the plug filetype plugin ON " start smart completion filetype plugin indent on
Reference documents: