vimrc常用配置以及vim常用操作

来源:互联网 发布:网页数据采集器 开源 编辑:程序博客网 时间:2024/06/07 16:18

配置记录,方便查看。


说明:

写在配置文件里的
1、 “双引号是注释

2、系统配置文件  /etc/vim/vimrc

      本用户配置文件 ~/.vimrc

使用:
1、尾行模式下执行外部命令时,前面加  !
2、当在vim时,会有个 .swp文件,防止断电保护。
3、其余使用参考:  http://www.cnblogs.com/jiqingwu/archive/2012/06/14/vim_notes.html


设定vim环境:

一般模式下:set all  显示所有可以设置的
一般使用:
set  all    显示目前所有的环境参数设定值
set          显示自己设定的环境,在vimrc中设置


一些自己常用的设置:

set  ts=4   设置tab=4,(ts = tabstop)
对于已保存的文件,可以使用下面的方法进行空格和TAB的替换:
TAB替换为空格:
:set ts=4
:set expandtab
:%retab!

空格替换为TAB:
:set ts=4
:set noexpandtab
:%retab!

加!是用于处理非空白字符之后的TAB,即所有的TAB,若不加!,则只处理行首的TAB。


" Vim5 and later versions support syntax highlighting. Uncommenting the next
" line enables syntax highlighting by default.
if has("syntax")
    syntax on
endif

这个是将语法检查打开


 55 "In order to convenient to use the VIM editor, set flow:
 56 "set line number
 57 set nu  /  nonu
 58 "set tab
 59 set tabstop=4
 60 "set nobackup
 61 set nobackup   //设置覆盖文件时不备份文件
 62 "set cursor
 63 set cursorline //设置当前行凸显,就是有一条行线
 64 "set state
 65 set ruler //设置底下的状态栏显示
 66 "set indent
 67 set autoindent     //设置自动缩进


set hlsearch / no...  hight light search 将搜索到的内容高亮
set autoindent / no.. 自动缩排
set backup             自动备份,备份的名字是 filename~
set ruler             设置右下角的状态显示否
set showmode           设置显示  ——INSERT——  这样的否
set backspace=(0/1/2) 编辑的时候可以用(Backspace)删除任意的字符,但是有的发行版不行,可以设置这个来操作。
                        2是可以删除任意   0/1是能删除刚才输入的,但是原本存在不能删除   
set syntax on         设置语法检错,必须的  不要设置off
 

0 0