The basic configuration of VIM

Source: Internet
Author: User
Tags mkdir


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.








Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.