On Sat, Oct 5, 2013 at 10:26 PM, Tony Mechelynck <antoine.mechelynck@gmail.com> wrote:
On 05/10/13 22:32, Ethan Hereth wrote:I mostly use cscope in relation with the Vim source.
Hey vim_use!
I've been a subscriber for quite a while now and thoroughly enjoy watching you experts at work. I've also been a vim user for some time and consider myself decently proficient with it although I've done very little scripting with it. I have had cscope on my TODO list for a while and finally sat down today to figure it out. I think I'll find its functionality very useful in my day to day use of vim.
I bet many of you use cscope every day and have developed nice shortcuts that make its use easy and quick. I have read the cscope page on vim.wikia.com and looked at the standard cscope_maps.vim settings that you can get from sourceforge (there seem to be mirrors of it everywhere...)
The thing is that I'm not sold on the maps/commands that I've seen so far. I've glanced on github as well but didn't find much there that tickled my fancy either. I have RTFM and think I understand everything there. I like how it works with ctags as well.
So, my question for everyone is: can you share with me the maps, habits, functions, etc. that you've developed over time to streamline your used of cscope within vim. I would love to see these. Really, I would love to get any advice you'd be willing to offer up about it.
I also was wondering if there is a easy way to make ctrl-] also jump to a source file (like stdio.h) if the cursor happened to be on a filename instead of a valid tag. (Does this even make sense to do?)
Thank you all in advance for your input!
The cscope database must be regenerated from time to time, or the quickfix lists generated by :cscope find will get out of step with the code.
On Unix-like platforms, I recommend doing that after compiling Vim at least once, so that auto-generated sources have been generated.
To build the database, I run the following command in the src/ source directory:
cscope -bv ./*.[ch] ./*.cpp ./if_perl.xs auto/*.h auto/pathdef.c proto/*.pro
In Vim, I have the following "aids" in my vimrc for cscope (some of the lines are quite long; I hope your mailer or mine won't mess them up):
if has('cscope')
set cst
if has('quickfix')
set csqf=s-,c-,d-,i-,t-,e-
endif
if version < 700
cnoreabbrev csa cs add
cnoreabbrev csf cs find
cnoreabbrev csk cs kill
cnoreabbrev css cs show
cnoreabbrev csh cs help
else
cnoreabbrev <expr> csa ((getcmdtype() == ':' && getcmdpos() <= 4)? 'cs add' : 'csa')
cnoreabbrev <expr> csf ((getcmdtype() == ':' && getcmdpos() <= 4)? 'cs find' : 'csf')
cnoreabbrev <expr> csk ((getcmdtype() == ':' && getcmdpos() <= 4)? 'cs kill' : 'csk')
cnoreabbrev <expr> css ((getcmdtype() == ':' && getcmdpos() <= 4)? 'cs show' : 'css')
cnoreabbrev <expr> csh ((getcmdtype() == ':' && getcmdpos() <= 4)? 'cs help' : 'csh')
endif
command -bar Cscope cs add $VIMSRC/src/cscope.out $VIMSRC/src
set csverb
endif
where $VIMSRC has been defined earlier in my vimrc as the top-level directory of my Vim repository clone (the parent of .hg, src, runtime, etc.)
Best regards,
Tony.
--
Screw up your courage! You've screwed up everything else.
Thank you gentlemen,
I've been busy but I should have an excuse to really use/implement this stuff soon. Gary, thanks for that ctags tipI will play around with these maps/abbreviations to see which of them feel right.Thanks again
--
--
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
--- You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
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
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment