Ubuntu modified. VIMRC to configure VIM

Source: Internet
Author: User
Tags set background
Ubuntu VIMRC settings are available for Ubuntu and Fedora Systems, and other systems are not validated.

Vim configuration files in Ubuntu are stored in the/etc/vim directory, with the configuration file named Ubuntu VIMRC

The configuration file for vim in Fedora is stored in the/etc directory with the configuration file named Ubuntu VIMRC

In the terminal, enter the following command to edit the Ubuntu vimrc configuration file:

sudo vim/etc/vim/vimrc or sudo gedit/etc/vim/vimrc


When using vim for editing under the terminal, by default, the editing interface is not displaying line numbers, syntax highlighting, smart indenting, and so on. In order to better work under Vim, a configuration file needs to be set manually:. vimrc.

When Vim is started, the. vimrc file under the current user's root directory is automatically read, and the file can contain settings and even scripts, so it is generally easier to create a. vimrc file under the current user's root directory.


The relevant commands are as follows:


The Create command is:

$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 Display line number

Set Nummber

"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;

In the first line, VIM uses the automatic alignment, which is to apply the current line's alignment format 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

"Removal of toolbar in the GUI version of Vim

Set guioptions-=t

"When Vim is editing, if the command is wrong, a sound is emitted, and the setting removes 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")

Set Nobackup

Else

Set backup

endif



If you remove the comment, a complete. VIMRC configuration information is as follows:



Set nocompatible

Set Nummber

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


If the discovery function does not work after the setup, check if the vim-enhanced package is installed under the system, and the query command is:

$rpm –q vim-enhanced

Resources:

1. A fully translated version of Vim can be found at the link below

[Url]http://vimcdoc.sourceforge.net/[/url]

Can be planted in one of the PDF version, which is described in detail, highly recommended:)

2. More detailed vim information can be accessed by:

[Url]http://www.vim.org/[/url]

3. A. VIMRC example with an English comment

[Url]http://www.vi-improved.org/vimrc.php[/url]
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.