将GVIM配置成一个Qt的开发环境(向IDE进军)
set nocompatible
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin
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
"""""""""""""""""""""个人增加的配置""""""""""""""""""""""
source d:/linux/vim/user.vim
尽量不修改原来的启动文件,另开始一个文件加入自己的配置信息:
user.vim的内容如下:
"-------------------------------------------------------------------------------------
" platform dependent
"-------------------------------------------------------------------------------------
if has("win32")
let $VIMDATA = $VIM.'/vimdata'
let $VIMFILES = $VIM.'/vimfiles'
let PYTHON_BIN_PATH = 'd:/foo/python/python.exe' " ensure the path right
set guifont=Courier_New:h16:b:cANSI
else
let $VIMDATA = $HOME.'/vimdata'
let $VIMFILES = $HOME.'/.vim'
let PYTHON_BIN_PATH = '/usr/bin/python'
set guifont=Courier_New:h16:cANSI
endif
"-------------------------------------------------------------------------------------
" Vim UI
"-------------------------------------------------------------------------------------
set linespace=1 " space it out a little more (easier to read)
set wildmenu " type :h and press <Tab> to look what happens
set ruler " always show current position along the bottom
set cmdheight=1 " use 2 screen lines for command-line
set lazyredraw " do not redraw while executing macros (much faster)
set number " don't print line number
set hid " allow to change buffer without saving
set backspace=2 " make backspace work normal
set whichwrap+=<,>,h,l " allow backspace and cursor keys to wrap
set mouse=a " use mouse in all modes
set shortmess=atI " shorten messages to avoid 'press a key' prompt
set report=0 " tell us when anything is changed via :...
set fillchars=vert:\ ,stl:\ ,stlnc:\
" make the splitters between windows be blank
"-------------------------------------------------------------------------------------
" folding
"-------------------------------------------------------------------------------------
set foldenable " turn on folding
set foldmethod=indent " make folding indent sensitive
set foldlevel=100 " don't autofold anything (but I can still fold manually)
set foldopen -=search " don't open folds when you search into them
set foldopen -=undo " don't open folds when you undo stuff
"""""""""""""""""""""""""""""
"WinManager Configure
"""""""""""""""""""""""""""""
let g:winManagerWindowLayout='FileExplorer'
nmap <F12> :WMToggle<cr>
"-------------------------------------------------------------------------------------
" plugin - taglist.vim
"-------------------------------------------------------------------------------------
"if has("win32")
"let Tlist_Ctags_Cmd = $VIMFILES.'/ctags.exe' " location of ctags tool
"else
"let Tlist_Ctags_Cmd = '/usr/local/bin/ctags'
"endif
let Tlist_Sort_Type = "name" " order by
let Tlist_Use_Right_Window = 1 " split to the right side of the screen
let Tlist_Compart_Format = 1 " show small meny
let Tlist_Exist_OnlyWindow = 1 " if you are the last, kill yourself
let Tlist_File_Fold_Auto_Close = 0 " do not close tags for other files
let Tlist_Enable_Fold_Column = 0 " do not show folding tree
nnoremap <F4> :TlistToggle<cr>
"-------------------------------------------------------------------------------------
" plugin - minibufexpl.vim
"-------------------------------------------------------------------------------------
let g:miniBufExplTabWrap = 1 " make tabs show complete (no broken on two lines)
let g:miniBufExplModSelTarget = 1
"-------------------------------------------------------------------------------------
" plugin - mru.vim (most recently used files)
"-------------------------------------------------------------------------------------
let MRU_File = $VIMFILES.'/_vim_mru_files' " which file to save mru entries
let MRU_Max_Entries = 20 " max mru entries in _vim_mru_files
"-------------------------------------------------------------------------------------
"OmniCppComplete : C/C++ omni-completion with ctags database
"-------------------------------------------------------------------------------------
filetype plugin indent on
set completeopt=longest,menu
set tags=D:\Qt\4.5.2\src\tags
2.我所用到的Plugin有如下所示:
a.vim
minibufexpl.vim
mru.vim
supertab.vim
taglist.vim
winfileexplorer.vim
winmanager.vim
wintagexplorer.vim
word_complete.vim
3.在使用ctags时我所用的命令如下:
ctags -R --c++-kinds=+p --fields=+iaS --extra=+q --excmd=number
注意:生成的tags使用的是相对路径,故不能动到别处使用.