= = The line number of VIM, syntax display and other settings (configuration of. vimrc files) = =
January 18, 2008 Friday 23:01
When using vim for editing under a terminal, by default,
The editing interface is not displaying line numbers, high-resolution syntax, smart indentation, and other functions.
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 convenient to create a. vimrc file under the current user's root directory, which is created as:
$vi ~/.VIMRC
When you're finished setting
$:x or $wq
Save to exit.
#去掉讨厌的有关vi一致性模式 to avoid some bugs and limitations of previous versions
Set nocompatible
#显示行号
Set Nummber
#检测文件的类型
FileType on
#记录历史的行数
Set history=1000
#背景使用黑色
Set Background=dark
#语法高亮度显示
Syntax on
#下面两行在进行编写代码时, which is useful in format alignment;
#vim使用自动对起, that is, the current row of the format to apply to the next line;
Set Autoindent
#依据上面的对起格式, intelligent choice of the way, for similar C language writing is very useful
Set Smartindent
#第一行设置tab键为4个空格, the second row sets the 4 spaces to use when interlaced between rows
Set tabstop=4
Set shiftwidth=4
#设置匹配模式, similar to the corresponding closing parenthesis when an opening parenthesis is entered
Set Showmatch
#去除vim的GUI版本中的toolbar
Set guioptions-=t
#当vim进行编辑时, if the command is wrong, a sound is emitted, and the setting removes the sound
Set VB t_vb=
#在编辑过程中, the status line in the lower-right corner of the cursor position is displayed
Set ruler
#默认情况下, look for a match that is high brightness display, this setting turns off highlighting
#set Nohls
#查询时非常方便, to find the book word, when input to/b, will automatically find the first
#个b开头的单词, when input to/bo, the word that begins with the first Bo is automatically found, depending on
#次类推, when searching, use this setting to quickly find the answer when you find a word to match
#时, don't forget to enter.
Set Incsearch
#修改一个文件后, automatic backup, backup file name is the original filename plus "~" suffix
If has ("VMS")
Set Nobackup
Else
Set backup
endif
# Vim Chinese cannot be displayed
: Set fileencodings=ucs-bom,utf-8,cp936
: Set Fileencoding=utf-8
: Set encoding=cp936
: Set Cul
======= If the comment is removed, a complete. VIMRC configuration information is as follows:
Set nocompatible
Set Nu
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
: Set fileencodings=ucs-bom,utf-8,cp936
: Set Fileencoding=utf-8
: Set encoding=cp936
: Set Cul
======================
#如果设置完后, the discovery function does not work, check the system is installed under the vim-enhanced package, the query command is:
$rpm –q vim-enhanced
Resources:
1. A fully translated version of Vim can be found at the link below
http://vimcdoc.sourceforge.net/
Can download one of the PDF version, which is described in detail, highly recommended:)
2. More detailed vim information can be accessed by:
http://www.vim.org/
3. A. VIMRC example with an English comment
http://www.vi-improved.org/vimrc.php
4. Chaoyuan. VIMRC
VIM default configuration