Linux常用vim命令(不断更新。。。)

来源:互联网 发布:jquery.min.js报错 编辑:程序博客网 时间:2024/06/08 05:58
  1. ctrl + n,vim代码补全。
  2. :%s/^A/\t/g,把^A分割符替换成tab%表示全局范围查找,g表示所有查找到的都会被替换,^A是按ctrl+a出来的。
  3. 一个数字n + 上下键,上下翻n页。
  4. dd,删除游标所在的一整行(常用)。

附录:

手感类似IDE的vi设置,修改~/.vimrc文件如下:

set nocompatibleset numberset nobackupfiletype onset history=1000set syntax=onset autoindentset smartindentset tabstop=4set softtabstop=4set shiftwidth=4set showmatchset matchtime=1set guioptions=Tset rulerset incsearchset completeopt=preview,longest,menu:inoremap ( ()<ESC>i:inoremap ) <c-r>=ClosePair(')')<CR>:inoremap { {}<ESC>i:inoremap } <c-r>=ClosePair('}')<CR>:inoremap [ []<ESC>i:inoremap ] <c-r>=ClosePair(']')<CR>:inoremap " ""<ESC>i:inoremap ' ''<ESC>ifunction! ClosePair(char)if getline('.')[col('.') - 1] == a:charreturn "\<Right>"elsereturn a:charendifendfunctionfiletype plugin indent on 

vi设置参考:
http://www.cnblogs.com/ma6174/archive/2011/12/10/2283393.html
http://iybk.blog.163.com/blog/static/19409510020117571224963/

原创粉丝点击