Xin Xing will share with you some tips on vim.
There is no doubt that vim is profound and profound. Here we will share some tips about vim, which I discovered today, because I just switched to vim soon, I am not familiar with many functions of vim, but I still have some configuration items on vim.
The first is automatic population and automatic indentation. This is extremely important to programmers. I think no programmer thinks indentation and population are irrelevant, however, automatic indentation and auto-completion of vim are not enabled by default. We need to make some settings. Next we will first talk about auto-completion. Here we will mainly discuss auto-completion of parentheses, add the following code to our configuration file:
"Auto-complete brackets if & term =" xterm "set t_Co = 8 set t_Sb = ^ [[4% dm set t_Sf = ^ [[3% dmendiflet g: neocomplcache_enable_at_startup = 1: inoremap (): inoremap) = ClosePair ('): inoremap {{}: inoremap} = ClosePair ('} '): inoremap [[]: inoremap] = ClosePair (']'): inoremap <>: inoremap> = ClosePair ('>') function ClosePair (char) if getline ('. ') [col ('. ')-1] = a: char return "" else return a: char endif endf
The second step is to set the line number, highlight, and indent rules, which are relatively simple. I will also extract my configuration first. For specific use, you can consider it as follows:
Set guifont = Courier \ New: h15set numberfiletype indent on "set automatic alignment set autoindent" set cindent for C Language "set SMART alignment set smartindent" set automatic indent set ai! "Set automatic match set showmatch" syntax highlighting syntax on "set indent width to 4 set shiftwidth = 4" tab width to 4 set tabstop = 4
The third is for some function names. Here we use php as an example. In fact, vim is used by default until the php function name, however, unlike Eclipse, it is automatically displayed when we move the cursor over the function name. It requires a series of operations, first, press Ctrl + X to enter the ^ x mode, and then press Ctrl + O to display the function name prompted by php, this file contains a vim file named phpcomplete In the autoload of vim74 in the vim folder. vim file. Note that the vim74 I mentioned here is my vim version number. if the version number is different from the version number, adjust it on your own.