Plugin
- ctags: 用于生成tags文件
- taglist: 便于快速的浏览一个大的代码文件,可以方便的在函数之间跳转。
- matchit: 在配对的标签或者字符之间跳转。可以用于html的标签跳转。
- autoclose: 自动输入配对的字符或者标签。
- xmledit: 对于xml类型的文件,自动输入对于的标签。
- pyclewn: gdb和pdb的vim潜入插件。
- 看起来snipMate很好用,有时间要试一下。
Customize
下面是一个我对于C的key mappings和abbreviation。
""" abbreviation
" helper function
func Eatchar(pat)
let c = nr2char(getchar(0))
return (c =~ a:pat) ? '' : c
endfunc
" include
iabbr <silent> #i #include
iabbr <silent> #d #define
" #ifn is an invalid abbreviation sequence, so use imap
imap <silent> #ifn #ifndef <CR>#endif<Up><C-o>:norm {1}lt;CR>
imap <silent> #ifd #ifdef <CR>#endif<Up><C-o>:norm {1}lt;CR>
iabbr <silent> #e #else
" control statement
iabbr <silent> if if ()<Left><C-R>=Eatchar('\s')<CR>
iabbr <silent> while while ()<Left><C-R>=Eatchar('\s')<CR>
iabbr <silent> for for (;;)<Left><Left><Left><C-R>=Eatchar('\s')<CR>
iabbr <silent> switch switch ()<Left><C-R>=Eatchar('\s')<CR>
""" key mappings
imap // <C-o>:s/^.*$/\/\* & *\/<CR><C-o>:noh<CR>
" pyclewn mappings
map <F5> :Pyclewn<CR>:Cfile <C-R>=expand("%:p:h") . "/" <CR>
下面是对C++的。
""" key mappings
imap // <C-o>:s/^./\/\/ &<CR>
vmap <silent> \\/ :s/^./\/\/ &<CR>:noh<CR>
下面是对Python的。
" key mappings
map <F5> :Pyclewn pdb <C-R>=expand("%")<CR><CR>
map <F10> :Cstep