The Ubuntu vimrc configuration file Vim sets the line number, indentation distance, and so on.

Source: Internet
Author: User
Tags set background

Ubuntu vimrc settings are applicable to Ubuntu and Fedora systems. Other systems are not verified.

In ubuntu, the vim configuration file is stored in the/etc/Vim directory. The configuration file name is Ubuntu vimrc.

In fedora, the vim configuration file is stored in the/etc directory. The configuration file name is Ubuntu vimrc.

Enter the following command on the terminal to edit the Ubuntu vimrc configuration file:

Sudo Vim/etc/Vim/vimrc or sudo gedit/etc/Vim/vimrc

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. it is easier to create a vimrc file in the root directory of the current user.

The related commands are as follows:


CREATE command:

$ 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 nummber

"Detection file type

Filetype on

"Records the number of historical rows

Set history = 1000

"Black is used for background

Set background = dark

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

"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 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 function does not work after setting, check whether the vim-enhanced package is installed in the system. The query command is:

$ Rpm-Q vim-enhanced

References:

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

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

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:

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

3. A. vimrc example with an English note

[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.