Saturday, May 26, 2012

Re: Cross referencing in VIM

Hi Adam,
I'm using VIM to develop my projects every day. They are mainly C code with some perl/python/batch and makefiles. You didn't mention which OS you are using. So i just  want to share my experience on Windows.
cscope is a great plugin to do what you want even though it isn't updated for  a while.
You can just download it and put it into PTAH. Then use it to generate a database file. In my case, i wrote a batch file to do this :
del cscope.out
ctags -R --c++-types=+p --fields=+iaS --extra=+q
gfind . -regex ".*\.\(c\|h\|mak\|py\|pl\|bat\|cmd\)" -not -regex ".*\(no_use\).*" -type f -printf "%%p\n" >cscope.file
cscope -Rb -icscope.file
After you get cscope.out(database file), you can open the gvim and use <:cs add cscope.out> to load your database file. Then you can lookup your symbols use cs find x xxxxxxx(you can find help by simply type :cs command)

BTW: there is a great plugin named cscope_maps.vim, it provide bunches of key map for cscope usage.

于 2012/5/18 11:39, hilal Adam 写道:

I am bias towards VIM when it comes to editors for doing development work (mainly C). But I have this problem regarding cross referencing. I use ctags which only provides half of the equation when I search for definitions of functions and variables. However, I haven't been able to find a useful way for doing cross referencing. For example in cases where I want find where a function is used, etc. I have come across cscope which is outdated and lacks proper documentation for how to install and run. Could anyone help with pointing to the right direction.
I appreciate any help in this respect.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


--   Thanks & Best Regards  Edward Xu

No comments:

Post a Comment