"Go" Vim environment settings and automatic alignment

Source: Internet
Author: User
Tags set background

Original URL: http://blog.chinaunix.net/uid-23525659-id-4340245.html

Note: If you are writing code with VIM, it is recommended to turn on Vim's file type auto-detection function, so that when the code is wrapped, it will be aligned automatically, without adding the following two lines of code in the VIMRC file. The way to turn on automatic file type detection is to add the following sentence in the VIMRC file: filetype plugin indent on

Just add these two lines to the/ETC/VIMRC.
Set Autoindent
Set Smartindent
--------------------------------------------------------


With:

Use under the terminalVimWhen editing, by default, the editing interface is not displayedLine number, syntax high brightness display, smart indent

and other functions. In order to better inVim, you need to manually set up a profile:. vimrc.
In the startVim, the. vimrc file under the current user's root directory is automatically read, and the file can contain settings or even scripts,

Therefore, it is generally convenient to create a. vimrc file under the root directory of the current user, which is the command created:
$vi ~/.VIMRC
When you're finished setting
$:x or $wq
Save to exit.
An example is given below, which lists the settings that are used frequently, and the detailed setup information in the reference material:
"Double quotation marks begin the behavior of the comment line, the same
"Get rid of nasty about VI consistency patterns, avoid some bugs and limitations of previous versions
Set nocompatible
The displayLine number
Set number
"Type of Detection file
FileType on
"Record the number of rows in history
Set history=1000
The background uses black
Set Background=dark
"Syntax High brightness display
Syntax on
"The following two lines are useful for formatting when writing code;
"The first line,VimUse automatic alignment, that is, the current line of the format to apply to the next line;
"The second line, according to the above format, intelligent selection of the way, for similar C language
"It's very useful to write.
Set Autoindent
Set Smartindent
The first line sets the TAB key to 4 spaces, the second row sets the 4 spaces when the rows are interleaved
Set tabstop=4
Set shiftwidth=4
"Sets the matching pattern, similar to the corresponding closing parenthesis when an opening parenthesis is entered
Set Showmatch
"RemoveVimToolbar in the GUI version
Set guioptions=t
"WhenVimWhen making edits, if the command is wrong, a sound will be issued, and the setting is removed from the sound
Set VB t_vb=
"During editing, the status line of the cursor position is displayed in the lower-right corner
Set ruler
"By default, the find match is high brightness display, this setting turns off highlighting
Set Nohls
Query is very convenient, if you want to find the book word, when input to/b, will automatically find the first
"A word beginning with B, when entered into the/bo, will automatically find the word that begins with the first Bo, depending on
"The second analogy, when searching, uses this setting to quickly find the answer when you find a word to match
"When you don't forget to enter
Set Incsearch
"After modifying a file, the backup file name is the original filename plus the" ~ "suffix.
If has ("VMS")//note double quotes to use half-width quotation marks ""
Set Nobackup
Else
Set backup
endif
If you remove the comment, a complete. VIMRC configuration information is as follows:
Set nocompatible
Set number
FileType on
Set history=1000
Set Background=dark
Syntax on
Set Autoindent
Set Smartindent
Set tabstop=4
Set shiftwidth=4
Set Showmatch
Set guioptions-=t
Set VB t_vb=
Set ruler
Set Nohls
Set Incsearch
If has ("VMS")
Set Nobackup
Else
Set backup
endif

Original Address http://acm.hrbeu.edu.cn/forums/index.php?showtopic=1834

"Go" Vim environment settings and automatic alignment

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.