Friday, September 15, 2006

我的vim设置

set nu
set hlsearch
set cindent shiftwidth=4
set fileencodings=ucs-bom,utf-8,chinese
set autoindent shiftwidth=4
set syntax=on
set noswapfile

:inoremap( ()i
:inoremap) =ClosePair(')')
:inoremap{ {}i
:inoremap} =ClosePair('}')
:inoremap[ []i
:inoremap] =ClosePair(']')

function ClosePair(char)
if getline('.')[col(',') - 1] == a:char
return "\"
else
return a:char
endif
endf


tabnew//开新的标签
set encoding=xxx//设定临时编码

VIM可以在某些事件发生时比如打开文件、保存文件、切换窗口时自动执行一些VIM命令,VIM的许多插件都利用了这个功能。常用的一种情况是把某种文件 后缀指定到一种文件格式上,比如*.jv指定到Java文件格式,这样在每次打开.jv类型的文件时自动使用Java的语法高亮:

:autocmd BufNewFile, BufRead *.jv :set ft=Java

连续插入多个字符或字符串

例如连续输入72个字母a

按ESC进入Normal mode,输入72ia再按ESC即可。


:noh取消高亮匹配

colorscheme evening设置色彩方案



No comments:

Labels

关于我

海淀, 北京, China