Friday, June 20, 2014

Cscope Made Easy

1. check  file  ~/.vimrc exist  ( if it does not exist  use
                                                         cp /usr/share/vim/vimrc ~/.vimrc  to create one )

2.  Add below lines to end of  the .vimrc file


set cscopequickfix=s-,c-,d-,i-,t-,e-
if has("cscope")
    set csprg=/usr/bin/cscope
    "add any database in current dir
    if filereadable("cscope.out")
        cs add cscope.out
    "else search cscope.out elsewhere
    else
    endif
endif


3.  Go to source code directory  and execute
         cscope -R

4.  once finished; do  ctrl + z  and exit out

5.  Open any file  using vim

6.  :cs  find t  <anysymbol>

7.  :clist  ( to see the result )

8.  :cw ( to split and show windows )

9. ctrl + w ( to switch between windows )

***************************************************
Get file name from different window to open file on different window

1. add below line to .vimrc

let @a=expand('%')
map <F2> :let @a=expand('%')<CR>
imap <F2> :let @a=expand('%')<CR>
nmap <F2> :let @a=expand('%')<CR>





2. press Esc then :

ctrl + R then press "a"

******************************************************* 

increase decrease window size
1. ctrl + w  , press arrow keys to move between windows
2. 10 -   // this will decrease window size


*********************vimdiff ----------------------------------
from one window

vert diffsplit  /workspace/tiger/%