summaryrefslogtreecommitdiff
path: root/.vim/cscope.vim
diff options
context:
space:
mode:
Diffstat (limited to '.vim/cscope.vim')
-rw-r--r--.vim/cscope.vim53
1 files changed, 53 insertions, 0 deletions
diff --git a/.vim/cscope.vim b/.vim/cscope.vim
new file mode 100644
index 0000000..53e4dd9
--- /dev/null
+++ b/.vim/cscope.vim
@@ -0,0 +1,53 @@
+if has("cscope")
+ set cscopetag
+ set csto=0
+ if $CSCOPE_DB != ""
+ cs add $CSCOPE_DB
+ else
+ let dirs = split($PWD, '/')
+ let paths = ['/']
+ for d in dirs
+ let paths = add(paths, paths[len(paths) - 1] . d . '/')
+ endfor
+
+ for d in reverse(paths)
+ let cscope_file = d . "/cscope.out"
+ if filereadable(cscope_file)
+ execute('cs add ' . cscope_file)
+ break
+ endif
+ endfor
+ endif
+
+ set cscopeverbose
+
+ nmap <C-\>s :cs find s <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-\>g :cs find g <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-\>c :cs find c <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-\>t :cs find t <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-\>e :cs find e <C-R>=expand("<cfile>")<CR><CR>
+ nmap <C-\>f :cs find f <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-\>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
+ nmap <C-\>d :cs find d <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-\>S :cs find t struct <C-R>=expand("<cword>")<CR> {<CR>
+
+ nmap <C-@>s :vert scs find s <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-@>g :vert scs find g <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-@>c :vert scs find c <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-@>t :vert scs find t <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-@>e :vert scs find e <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-@>f :vert scs find f <C-R>=expand("<cfile>")<CR><CR>
+ nmap <C-@>i :vert scs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
+ nmap <C-@>d :vert scs find d <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-@>S :vert scs find t struct <C-R>=expand("<cword>")<CR> {<CR>
+
+ nmap <C-@><C-@>s :scs find s <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-@><C-@>g :scs find g <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-@><C-@>c :scs find c <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-@><C-@>t :scs find t <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-@><C-@>e :scs find e <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-@><C-@>f :scs find f <C-R>=expand("<cfile>")<CR><CR>
+ nmap <C-@><C-@>i :scs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
+ nmap <C-@><C-@>d :scs find d <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-@><C-@>S :scs find t struct <C-R>=expand("<cword>")<CR> {<CR>
+endif