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.