Vim settings. vimrc

Source: Internet
Author: User
Tags set background

When you use Vim to edit a terminal, by default, the editing interface does not display line numbers, syntax High Brightness Display, smart indentation, and other functions. To better work in Vim, You need to manually set a configuration file:. vimrc.

When Vim is started. the vimrc file is automatically read, which can contain some settings or even scripts. the vimrc file is easy to create in the root directory of the current user, that is, the command to create is:

$ 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

"Display the row number (it is necessary to view the code)

Set nummber

"Detection file type

Filetype on

"Records the number of historical rows

Set history = 1000

"The background is black (we recommend that you do not set it in Ubuntu)

Set background = dark

"Syntax High Brightness Display (we recommend that you do not set it in Ubuntu. It is better to use the default system highlight 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, which is useful for programming similar to the C language.

Set autoindent

Set smartindent

"The Tab key in the first line is set to 4 spaces, and the second line is set to use 4 spaces when the lines are staggered (it is much easier to write Python code, so you don't need to press the space)

Set tabstop = 4

Set shiftwidth = 4

"Set the matching mode, similar to the right brace that will match when you enter a left brace (good thing, so you do not forget to enter the right brace)

Set showmatch

"Remove toolbar from Vim's Gui version

Set guioptions-= T

"When Vim is being edited, if a command error occurs, a sound will be triggered. This setting removes the sound.

Set VB t_vb =

"The status line at the cursor position is displayed in the lower right corner during editing.

Set ruler

"By default, matching is displayed in High Brightness. This setting turns off the highlighted display.

Set nohls

"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

If has ("VMS ")

Set nobackup

Else

Set backup

Endif

After the annotation is removed, a complete. vimrc configuration is as follows:

Set nocompatible

Set number

Filetype on

Set history = 1000

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

References:

1. Complete Vim translation can be found at the following link

Http://vimcdoc.sourceforge.net/

You can download one of the PDF versions, which are described in detail. We strongly recommend that you :)

2. For more detailed Vim information, visit:

Http://www.vim.org/

3. A. vimrc example with an English note

Http://www.vi-improved.org/vimrc.php

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.