我的vim 配置
$HOME目录下的.vimrc的 配置
不得不说vim确实是很强大的代码编辑器,虽然开始学习比较其他编辑器时间长,但真的值啦!
下面是我的vim一些配置。
set nocompatibleset nuset relativenumber "相对行号set ignorecasesource $VIMRUNTIME/vimrc_example.vimsource $VIMRUNTIME/mswin.vimbehave mswinset enc=utf-8set fencs=utf-8,ucs-bom,shift-jis,gb18030,gbk,gb2312,cp936set langmenu=zh_CN.UTF-8language message zh_CN.UTF-8set guifont=Bitstream_Vera_Sans_Mono:h10:cANSI"解决菜单中文乱码问题source $VIMRUNTIME/delmenu.vimsource $VIMRUNTIME/menu.vimset foldmethod=indent "代码折叠set foldminlines=15set ignorecaseset directory=$HOME"隐藏工具栏和菜单栏set guioptions-=mset guioptions-=T"与Windows共享剪贴板set clipboard+=unnamedcolorscheme molokailet mapleader = ","set diffexpr=MyDiff()function MyDiff()let opt = '-a --binary 'if &diffopt =~ 'icase' | let opt = opt . '-i ' | endifif &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endiflet arg1 = v:fname_inif arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endiflet arg2 = v:fname_newif arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endiflet arg3 = v:fname_outif arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endiflet eq = ''if $VIMRUNTIME =~ ' 'if &sh =~ '\<cmd'let cmd = '""' . $VIMRUNTIME . '\diff"'let eq = '"'elselet cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'endifelselet cmd = $VIMRUNTIME . '\diff'endifsilent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . eqendfunctionfiletype on" 此处规定Vundle的路径set rtp+=$VIM/vimfiles/bundle/vundle/call vundle#rc('$VIM/vimfiles/bundle/')Bundle 'gmarik/vundle'filetype plugin indent on" original repos on github<br>Bundle 'mattn/zencoding-vim'Bundle 'drmingdrmer/xptemplate'" vim-scripts repos 插件管理Bundle 'L9'Bundle 'a.vim'Bundle 'OmniCppComplete'Bundle 'FuzzyFinder'Bundle 'bufexplorer.zip'Bundle 'taglist.vim'Bundle 'Mark'Bundle 'The-NERD-tree'Bundle 'matrix.vim'Bundle 'closetag.vim'Bundle 'The-NERD-Commenter'Bundle 'matchit.zip'Bundle 'AutoComplPop'Bundle 'jsbeautify'Bundle 'YankRing.vim'Bundle 'Markdown'Bundle 'Markdown-syntax'Bundle "honza/vim-snippets"filetype plugin indent on " required!"插件配置"let g:vim_markdown_folding_disabled=1"快捷键(F9)打开TagListmap <silent> <F9> :TlistToggle<cr>map <silent> <F8> :NERDTree<cr>"set TEMP='C:\Documents and Settings\Administrator\Local Settings\Temp'"let Tlist_Ctags_Cmd='D:\Program Files\Vim\vim74\ctags.exe'let Tlist_Ctags_Cmd='D:\ctags.exe'let Tlist_Show_One_File=1let Tlist_Exit_OnlyWindow=1"如果taglist窗口是最后一个窗口,则退出vimlet Tlist_Exit_OnlyWindow = 1"在右侧窗口中显示taglist窗口let Tlist_Use_Right_Window = 1set tags+=$VIM/vimfiles/tags/cppset tags=tags;map <C-F12> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR>let OmniCpp_NamespaceSearch = 1let OmniCpp_GlobalScopeSearch = 1let OmniCpp_ShowAccess = 1let OmniCpp_ShowPrototypeInAbbr = 1 " show function parameterslet OmniCpp_MayCompleteDot = 1 " autocomplete after .let OmniCpp_MayCompleteArrow = 1 " autocomplete after ->let OmniCpp_MayCompleteScope = 1 " autocomplete after ::let OmniCpp_DefaultNamespaces = ["std", "_GLIBCXX_STD"]" automatically open and close the popup menu / preview windowau CursorMovedI,InsertLeave * if pumvisible() == 0|silent! pclose|endifset completeopt=menuone,menu,longest,previewlet g:snipMate = {}let g:snipMate.scope_aliases = {}let g:snipMate.scope_aliases['ruby'] = 'ruby,rails'augroup filetypedetectau! BufRead,BufNewFile *nc setfiletype ncaugroup END
上述快捷键
F8: 文件目录,
F9: 生成taglist标签,
:A : 打开对应头文件的源文件(.h 与.c 文件切换)
“,+c+space”:反/注释代码
下面 是以上配置效果图

附件列表
浙公网安备 33010602011771号