[vim] change the way that tags could be build

This commit is contained in:
Mathieu Maret 2010-04-26 10:35:32 +02:00
parent 89d4341651
commit 22ada08b14

37
.vimrc
View File

@ -10,6 +10,7 @@
" F7 go to calls
" F8 view tag list
" S-F8 build ctags/cscope databases
" M-F8 build kernel ctags/cscope databases
" F9 view changes
" F10 folding ?
" F11 unhighlight search
@ -328,21 +329,31 @@ if has("cscope")
" i includes find files that include the filename under cursor
" d called find functions that function under cursor calls
endif
" build tags database with shift+F8
if has("cscope")
command! TagsBuild
\ :!echo "building ctags and cscope databases..." &&
\ ctags --c++-kinds=+p --fields=+iaS --extra=+q -R &&
\ cscope -bR
map <S-F8> :TagsBuild<CR><CR>:cscope reset<CR><CR>
else
command! TagsBuild
\ :!echo "building ctags database..." &&
\ ctags --c++-kinds=+p --fields=+iaS --extra=+q -R
\:set tags=./tags,./../tags,./../../tags,./../../../tags,tags
map <S-F8> :TagsBuild<CR><CR>
" build tags database with shift+F8 or alt+F8 to ignore /usr/include
command! CtagsBuild
\ :!echo 'building ctags database...' ;
\ ctags --fields=+iaS --extra=+q --totals -R &&
\ echo 'adding system headers...' ;
\ find -exec gcc -M '{}' \; 2>&- | tr '[:space:]' '\n' | grep '^/.*' | sort -u |
\ ctags --c-kinds=+px --c++-kinds=+px --fields=+iaS --extra=+q -aL-
command! CtagsKernelBuild
\ :!echo 'building ctags database in kernel mode...' ;
\ ctags --fields=+iaS --extra=+q --totals -R
command! CscopeBuild
\ :!echo 'building cscope database...' ;
\ cscope -bR
command! CscopeKernelBuild
\ :!echo 'building cscope database in kernel mode...' ;
\ cscope -bkR
if has("cscope")
map <S-F8> :CtagsBuild<CR><CR>:CscopeBuild<CR><CR>:cscope reset<CR><CR>
map <M-F8> :CtagsKernelBuild<CR><CR>:CscopeKernelBuild<CR><CR>:cscope reset<CR><CR>
else
map <S-F8> :CtagsBuild<CR><CR>
map <M-F8> :CtagsKernelBuild<CR><CR>
endif
" close preview window after a completion
if has("autocmd")
autocmd CursorMovedI *.{[hc],cpp} if pumvisible() == 0|pclose|endif