Installation and configuration of vim under CentOS

Source: Internet
Author: User


1 Installation

(If it is a newly installed CentOS, it is best to follow vim before the installation of the necessary common support libraries in Linux: http://blog.csdn.net/clevercode/article/details/45438401)

# yum-y Install vim*


2 Viewing the location of vim

# Whereis Vim



3 If the normal user Vim is not highlightedIf the user below/home vim is not highlighted; $ echo $TERM vt100
3.1 Solution OneModify the terminal to be a xterm. As below, log in again.


Re-Login
$ exit$ echo $TERM xterm


3.2 Solution Two: (usually plan one, it can be done)If the output is not xterm-color, you need to set it manually. Add a row at the end of the/etc/profile file to export $TERM =xterm-color then make the modification effective # Source/etc/profile.
# Vim/etc/profile
Normal User Login again
$ exit$ echo $TERM xterm
4 Configuration related

4.1 viminfoIn Vim, Vim is automatically recorded and saved in the ~/.viminfo file. This is to facilitate the next processing, such as: Vim when you open the file, the cursor will automatically appear in the last location. The original searched string, the newly opened file is automatically highlighted.
The ~/.viminfo file is automatically generated by the system.


4.2 VIMRC (Global:/ETC/VIMRC, User: ~/.VIMRC)The VIMRC file is a VIM environment settings file. The overall vim setting is in the/ETC/VIMRC file. Modifying the/ETC/VIMRC file is not recommended, and each user can set up vim in the user's root directory and create a new ~/.VIMRC. Vim has more configuration options.


4.3 new user's VIMRC

# Vim ~/.VIMRC

"Syntax high brightness display syntax on" set line number set Nu "Set TAB4 space set Tabstop=4set expandtab" program Auto indent time space set shiftwidth=4 "backspace key Delete 4 spaces set at a time Softtabstop=4 "In the edit process, the status line of the cursor position in the lower right corner of the set ruler" search ignores case set ignorecase "Vim uses the automatic alignment, that is, the current row of the format applied to the next row set Autoindent" According to the above format, intelligent selection of the way, for similar to the C language writing very useful set smartindent "In the Status column display currently executed instruction set ShowCmd" Set color theme ColorScheme Desert



Installation and configuration of vim under CentOS

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.