Basic Configuration
Terminal run:
Vim ~/.VIMRC
Configuration content is as follows:
set nocp "set compatible
set expandtab "Set tab
set shiftwidth = 4 "Set the interval of the tab
set tabstop = 4 "Four spaces represent a tab
set sts = 4
set showmatch "When you enter a parenthesis, the cursor will briefly jump to the matching parenthesis
set autoindent "Set autoindent
set number "Set whether to display lines
set guifont = Monospace \ 12 "Set font size
set encoding = utf-8 "Set encoding to utf-8
set fileencoding = utf-8
set fileencodings = ucs-bom, utf-8, GB18030, cp936, big5, euc-jp, euc-kr, latin1
"Autocomplete configuration
autocmd FileType python set omnifunc = pythoncomplete # Complete
autocmd FileType javascript set omnifunc = javascriptcomplete # CompleteJS
autocmd FileType html set omnifunc = htmlcomplete # CompleteTags
autocmd FileType css set omnifunc = csscomplete # CompleteCSS
autocmd FileType xml set omnifunc = xmlcomplete # CompleteTags
autocmd FileType php set omnifunc = phpcomplete # CompletePHP
autocmd FileType c set omnifunc = ccomplete # Complete
"######## Braces Braces Braces Autocomplete
: inoremap (() <ESC> i
: inoremap) <c-r> = ClosePair (')') <CR>
: inoremap {{} <ESC> i
: inoremap} <c-r> = ClosePair (')') <CR>
: inoremap [[] <ESC> i
: inoremap] <c-r> = ClosePair (')') <CR>
: inoremap <<> <ESC> i
: inoremap> <c-r> = ClosePair ('>') <CR>
function ClosePair (char)
if getline ('.') [col ('.')-1] == a: char
return "\ <Right>"
else <pre name = "code" class = "plain"> sudo apt-get install exuberant-ctags
</ pre> <br> return a: char endif endfunction "####### Braces Braces Braces Autocomplete
Code Auto-Completion
First install Ctags
sudo apt-get install Exuberant-ctags
Create a. Vim folder in the home directory, and then press create several subdirectories:
CD. Vim
mkdir plugin
mkdir doc
mkdir tags
Download Omnicppcomplete, point me to download
After decompression production three folders, after, AutoLoad, doc I put these three folders directly in the. Vim folder.