diff --git a/.vimrc b/.vimrc index fbaaf69..35b80d9 100644 --- a/.vimrc +++ b/.vimrc @@ -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 :TagsBuild:cscope reset -else - command! TagsBuild - \ :!echo "building ctags database..." && - \ ctags --c++-kinds=+p --fields=+iaS --extra=+q -R - \:set tags=./tags,./../tags,./../../tags,./../../../tags,tags - map :TagsBuild +" 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 :CtagsBuild:CscopeBuild:cscope reset + map :CtagsKernelBuild:CscopeKernelBuild:cscope reset +else + map :CtagsBuild + map :CtagsKernelBuild endif + " close preview window after a completion if has("autocmd") autocmd CursorMovedI *.{[hc],cpp} if pumvisible() == 0|pclose|endif