ITeye博客

我的.vimrc配置

opencrazy · 2009-04-08 22:19 · Linux/Unix · Markdown

"Set mapleader "let mapleader = "," "let g:mapleader = "," " if &term=="xterm" set t_Co=8 set t_Sb=^,.sh,.java exec ":call SetTitle()" "新建文件后,自动定位到文件末尾 "autocmd BufNewFile * normal G " ""设置Java代码的自动补全 "au FileType java setlocal omnifunc=javacomplete#Complete

"绑定自动补全的快捷键到; "imap ; " ""设定开关Taglist插件的快捷键为F4,可以在VIM的左侧栏列出函数列表等 map :Tlist

"设置程序的运行和调试的快捷键F5和Ctrl-F5 map :call CompileRun() "map :call Debug() " ""设置tab操作的快捷键,绑定:tabnew到t,绑定:tabn, :tabp到n, "p "map t :tabnew "map n :tabn "map p :tabp " ""用cscope支持 "set csprg=/usr/bin/cscope "let Tlist_Ctags_Cmd='/usr/bin/ctags' "let Tlist_Show_One_File=1 "let Tlist_Exit_OnlyWindow=1 "let Tlist_Use_Right_Window=1 "默认打开Taglist let Tlist_Auto_Open=1 """""""""""""""""""""""""""""" " Tag list (ctags) """""""""""""""""""""""""""""""" let Tlist_Ctags_Cmd = '/usr/bin/ctags' let Tlist_Show_One_File = 1 "不同时显示多个文件的tag,只显示当前文件的 let Tlist_Exit_OnlyWindow = 1 "如果taglist窗口是最后一个窗口,则退出vim let Tlist_Use_Right_Window = 1 "在右侧窗口中显示taglist窗口

"使用e打开当前文件同目录中的文件 "if has("unix") "map ,e :e =expand("%:p:h") . "/" "else "map ,e :e =expand("%:p:h") . "" "endif " ""定义CompileRun函数,用来调用进行编译和运行 func CompileRun() exec "w" "C程序 if &filetype == 'c'||&filetype == 'cpp' exec "!g++ % -g -o %<" exec "!./%<" ""Java程序

elseif &filetype == 'java' exec "!javac %" exec "!java %<" endif endfunc "结束定义CompileRun " ""定义Debug函数,用来调试程序 func Debug() exec "w" "C程序 if &filetype == 'c' exec "!gcc % -g -o %<" exec "!gdb %<" ""Java程序 elseif &filetype == 'java' exec "!javac %" exec "!jdb %<" endif endfunc "结束定义Debug " ""定义函数SetTitle,自动插入文件头 func SetTitle() "如果文件类型为.sh文件 if &filetype == 'sh' call setline(1,"#########################################################################") call append(line("."), "# Author: Charlse.Zhang") call append(line(".")+1, "# Created Time: ".strftime("%c")) call append(line(".")+2, "# File Name: ".expand("%")) call append(line(".")+3, "# Description: ") call append(line(".")+4, "#########################################################################") call append(line(".")+5, "#!/bin/bash") call append(line(".")+6, "") else call setline(1, "/*************************************************************************") call append(line("."), " Author: Zhengyou Zhou") call append(line(".")+1, " Created Time: ".strftime("%c")) call append(line(".")+2, " File Name: ".expand("%")) call append(line(".")+3, " Description: ") call append(line(".")+4, " ************************************************************************/") call append(line(".")+5, "") endif endfunc autocmd FileType python set omnifunc=pythoncomplete#Complete autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS autocmd FileType html set omnifunc=htmlcomplete#CompleteTags autocmd FileType css set omnifunc=csscomplete#CompleteCSS autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags autocmd FileType php set omnifunc=phpcomplete#CompletePHP autocmd FileType c set omnifunc=ccomplete#Complete autocmd FileType java set omnifunc=javacomplete#Complete

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。