Write down some Vim configurations

Source: Internet
Author: User

In the past two days, we found that the editing function of VIM was really powerful. I learned a little about it, Vim, G ++ compiler, and GDB... In the cainiao stage, Daniel ignores it... Below are some of the configurations used for this dish:

$ VI ~ /. Vimrc
After setting
$: X or $ WQ
Save and exit.
The following example shows the frequently used settings. For detailed settings, see references:
"Comments rows starting with double quotation marks, the same below
"Remove the annoying VI consistency mode and avoid bugs and limitations in earlier versions.
Set nocompatible
"Show row number
Set number
"Detection file type
Filetype on
"Records the number of historical rows
Set history = 1000
"Syntax High Brightness Display
Syntax on
"The following two lines are useful in the format when writing code;
"In the first line, VIM uses automatic start, that is, to apply the format of the current row to the next line;
"The second line, based on the preceding setup format, intelligently selects the setup method.
"Writing is very useful.
Set autoindent
Set cindent
Set smartindent
"The Tab key of the first line is set to 4 spaces, and the second line is set to use 4 spaces when lines are staggered.
Set tabstop = 4
Set shiftwidth = 4
"Set the matching mode, similar to the right brace that will be matched when a left brace is entered.
Set showmatch
"The status line at the cursor position is displayed in the lower right corner during editing.
Set ruler
"It is very convenient to query. To search for the book word, when/B is entered, the first
"A word starting with B. When it is input to/Bo, it will automatically find the word starting with the first Bo, according
"And so on, you can use this setting to quickly find the answer.
"Don't forget to press ENTER
Set incsearch
"After a file is modified, it is automatically backed up. The backup file name is added to the original file name." ~ "Suffix
After the annotation is removed, a complete. vimrc configuration is as follows:

Set nu "show row number set nocompatible" do not use Vim to imitate VI Mode. We recommend that you set it, otherwise there will be a lot of incompatibility issues "set cursorline" highlight the current row filetype onset autoreadset autoindent "auto indent set cindent" C/C ++ auto indent set smartindentset tabstop = 4 "4 cells indent set shiftwidth = 4 set showmatchset Rory "display the row number set incsearchset history = 1000" select all copy and paste "Map <c-A> ggvg" GG to the beginning of the file, V select a row, G to the end of the file Map <c-c> "+ y Map <c-V>" + P "======== compile & run ==== = "func! Compilecode () EXEC "W" IF & filetype = 'C' EXEC "! Gcc-wall-w-G %-o % <"elseif & filetype = 'cpp 'exec "! G ++-wall-w-G %-o % <"elseif & filetype = 'java' EXEC "! Javac % "elseif & filetype = 'sh ':!. /% Endifendfunc "Run func! Compilerun () EXEC "W" IF & filetype = 'C' EXEC "! ./% <"Elseif & filetype = 'cpp 'exec "! ./% <"Elseif & filetype = 'java' EXEC "! Java % <"elseif & filetype = 'sh ':!. /% Endifendfunc "Call gdbfunc! Rungdb () EXEC "" EXEC "! GDB./% <"endfuncmap <C-F10>: Call compilerun () <CR> Map <C-F9>: Call compilecode () <CR>
Map <C-F8>: Call rungdb () <CR>

// Last update 2012/09/15 by von

 

 

Comes with a Vim magic Tutorial: http://blog.jobbole.com/18339/

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.