vim: Add cscope keyboard shortcuts
authorColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Mon, 15 Feb 2010 21:58:55 +0000 (13:58 -0800)
committerColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Mon, 15 Feb 2010 21:58:55 +0000 (13:58 -0800)
.vim/plugin/cscope_settings.vim [new file with mode: 0644]

diff --git a/.vim/plugin/cscope_settings.vim b/.vim/plugin/cscope_settings.vim
new file mode 100644 (file)
index 0000000..86732b9
--- /dev/null
@@ -0,0 +1,24 @@
+" Make sure that vim was compiled with the '--enable-cscope' option
+if has("cscope")
+    set cscopetag
+
+    " check cscope for definition of a symbol before checking ctags
+    set csto=0
+
+    " add any cscope database in current directory
+    if filereadable("cscope.out")
+        cs add cscope.out
+    endif
+
+    " show msg when any other cscope db added
+    set cscopeverbose
+
+    nmap \s :cs find s <C-R>=expand("<cword>")<CR><CR>
+    nmap \g :cs find g <C-R>=expand("<cword>")<CR><CR>
+    nmap \c :cs find c <C-R>=expand("<cword>")<CR><CR>
+    nmap \t :cs find t <C-R>=expand("<cword>")<CR><CR>
+    nmap <C-\>e :cs find e <C-R>=expand("<cword>")<CR><CR>
+    nmap \f :cs find f <C-R>=expand("<cfile>")<CR><CR>
+    nmap <C-\>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
+    nmap \d :cs find d <C-R>=expand("<cword>")<CR><CR>
+endif