Set vim default parameters such as setting the default background color

Source: Internet
Author: User
Tags set background

Because of my personal preference, I like to set the background color to dark when I use VIM.

But each time you open a vim to reset it, it feels very troublesome.

Always enter [ESC]: Set Bg=dark is inconvenient

The rough way is to go directly to the/etc/folder to modify the configuration file, as follows, but this method is not recommended,

Because the file under the/etc/folder requires root permission to modify, and once the error is changed the whole system is prone to problems

Method One:

CentOS, for example, has a configuration file path of/ETC/VIMRC (/ETC/VIM/VIMRC different versions, may not be the same)

Get root Permission First

Su

Enter the root password

Then open the file

Vi/etc/vimrc

Find out if a set BG setting is already in the file

/bg

Not found, default background set to light

Add Background Settings command (remember to add comments):

Set Bg=dark "Set background color as dark. It can also is changed as light

Exit Edit

: Wq

Method Two:

Create a Vim environment settings file in the current user's home directory, write the parameters that need to be set

[Email protected] ~]$ VI ~/.VIMRC

Set Nohlsearch "Non-high brightness anti-white
Set autoindent "Auto Indent
Set ruler to show the status of the last row
Set Showmode "The bottom left corner of which line of state
Set Nu "can display line numbers at the front of each line
Set Bg=dark "background setting to Black
Syntax on "Grammar check, color display

Set vim default parameters such as setting the default background color

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.