gbog wrote:
> Dear vim experts,
>
> I have vim with ctags and a question:
>
> on another computer, when I did ctrl-] on a function name, if I had
> two matches in ctags (file), both were displayed in the bottom of the
> screen
> and I could choose the one I wanted to jump to. Now I directly jump to
> the first match, without any notice that I had multiple matches. I
> prefer the other way, so I always know I have many matches in ctags.
> How to configure my current vim for this?
>
> [update: I do not use cscope]
>   
I recently had this same problem.  The fix is to put the following in 
your .vimrc file:

:set cscopetag

Though you are not using cscope, this is the option you want.  This 
changes :tag and CTRL-] to use cscope's algorithm, which is to jump to 
unique tags or provide a menu when there are duplicates.  By default, 
Vim will check cscope databases first ,then fall back to checking 
regular tags files.  You can also :set cscopetagorder=1 to search tags 
before cscope databases, but it won't be necessary unless you have added 
a cscope database.

I discovered this feature of 'cscopetag' when I noticed that Vim on 
Ubuntu didn't give me a menu when I pressed CTRL-], whereas on Fedora it 
did, even though I had identical ~/.vimrc files.  The system-wide vimrc 
file on Fedora checks for the presence of /usr/bin/cscope.  If it finds 
cscope, it sets 'cscopetag' for you.  I'd been getting the 'cscopetag' 
option for free on Fedora, but on Ubuntu it wasn't being set automatically.

Oddly, there doesn't appear to be a way to get the cscope-like tag 
behavior for CTRL-] without setting 'cscopetag'.  You could 
alternatively remap CTRL-] (which normally behaves like :tag) to g 
CTRL-L (which behaves like :tjump), if I understand the documentation 
correctly.  Since I'm thinking of trying out cscope, though, I'll be 
setting cscopetag anyway, so I'm happy with this option for myself.

Michael Henry


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to