Customizing the template file for VIM usage environment

Source: Internet
Author: User

Each time to the new machine to use VIM to modify the configuration file, you have to re-set the environment of vim, such as indentation, display line number, syntax highlighting, and so on, each time set, too troublesome, so find the data to write the usual settings in the home directory. vimrc file (default does not exist, need to create), as follows:


Vim. VIMRC

Set Nobackupset noswapfileset nohlsearchset numberset cindentset autoindentset shiftwidth=2set tabstop=2set softtabstop =2set Expandtabset Rulerset Mouse=vsyntax on



Common Setting Instructions:


Here are some of the settings that are commonly used in vim and their specific meanings:


set Nobackup: Do not back up files, use Backup to back up files (original file plus suffix ~).

set Noswapfile: Do not generate. swap files. I always have a habit before I edit a file, and I usually use it in the original

to a. Bak backup before you can confidently modify it on the relevant file. If the action cautious friend advises not to this

Item

Set Number: Displays line numbers.

set Cindent: Set C-style indentation and use Nocindent to cancel the setting.

set Autoindent: Set auto indent, each line is indented equal to the previous line, you can use Noautoindent to cancel the set

Reset

Set shiftwidth=2: Sets the indent to two spaces.

set tabstop=2: Set tab to two spaces.

set softtabstop=2: Set the Soft tab to two spaces.

set Expandtab: Indents and (soft) tabs use space overrides, which can be noexpandtab to cancel settings.

Set Ruler: Displays the row number of the cursor.

Set Mouse=v: If we use set Mouse=a to start all modes and block the right-click function of the mouse, then

This syntax allows you to use the right mouse button copy function in vim visualization mode.

syntax on: start syntax highlighting.


Keep this file (. vimrc) in place, and then the machine will be placed directly in the current user's home directory and renamed to. VIMRC, which makes it a lot easier to use.


This article is from the "Balich" blog, make sure to keep this source http://balich.blog.51cto.com/6641781/1760411

Customizing the template file for VIM usage environment

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.