Xin Xing will share with you some tips on vim.

Source: Internet
Author: User

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.

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.