我的vim 配置
$HOME目录下的.vimrc的 配置
不得不说vim确实是很强大的代码编辑器,虽然开始学习比较其他编辑器时间长,但真的值啦!
下面是我的vim一些配置。
set nocompatible
set nu
set relativenumber "相对行号
set ignorecase
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin
set enc=utf-8
set fencs=utf-8,ucs-bom,shift-jis,gb18030,gbk,gb2312,cp936
set langmenu=zh_CN.UTF-8
language message zh_CN.UTF-8
set guifont=Bitstream_Vera_Sans_Mono:h10:cANSI
"解决菜单中文乱码问题
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
set foldmethod=indent "代码折叠
set foldminlines=15
set ignorecase
set directory=$HOME
"隐藏工具栏和菜单栏
set guioptions-=m
set guioptions-=T
"与Windows共享剪贴板
set clipboard+=unnamed
colorscheme molokai
let mapleader = ","
set diffexpr=MyDiff()
function MyDiff()
let opt = '-a --binary '
if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
let arg1 = v:fname_in
if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
let arg2 = v:fname_new
if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
let arg3 = v:fname_out
if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
let eq = ''
if $VIMRUNTIME =~ ' '
if &sh =~ '\<cmd'
let cmd = '""' . $VIMRUNTIME . '\diff"'
let eq = '"'
else
let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
endif
else
let cmd = $VIMRUNTIME . '\diff'
endif
silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . eq
endfunction
filetype 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)打开TagList
map <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=1
let Tlist_Exit_OnlyWindow=1
"如果taglist窗口是最后一个窗口,则退出vim
let Tlist_Exit_OnlyWindow = 1
"在右侧窗口中显示taglist窗口
let Tlist_Use_Right_Window = 1
set tags+=$VIM/vimfiles/tags/cpp
set tags=tags;
map <C-F12> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR>
let OmniCpp_NamespaceSearch = 1
let OmniCpp_GlobalScopeSearch = 1
let OmniCpp_ShowAccess = 1
let OmniCpp_ShowPrototypeInAbbr = 1 " show function parameters
let 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 window
au CursorMovedI,InsertLeave * if pumvisible() == 0|silent! pclose|endif
set completeopt=menuone,menu,longest,preview
let g:snipMate = {}
let g:snipMate.scope_aliases = {}
let g:snipMate.scope_aliases['ruby'] = 'ruby,rails'
augroup filetypedetect
au! BufRead,BufNewFile *nc setfiletype nc
augroup END
上述快捷键
F8: 文件目录,
F9: 生成taglist标签,
:A : 打开对应头文件的源文件(.h 与.c 文件切换)
“,+c+space”:反/注释代码
下面 是以上配置效果图
附件列表