2

When the cursor is over a word that has multiple matches according to ctags, the Ctrl-] command on one machine I use gives me a list of matches to choose from, while on another it just populates the tag stack and takes me to the first match. I prefer the first behavior, because it lets me see up front how many matches there are and lets me jump into the middle of the list if the first match is not what I'm looking for.

How can I make Vim on the second machine default to the behavior of Vim on the first machine?

I've diffed the ~/.vimrc between the two machines, and I don't see any customization differences that can account for the difference in behavior.

  • Look into g] (and write an answer on it?) – D. Ben Knoble Jul 4 '18 at 23:42
2

You can use :set cscopetag to get that effect. When this setting is enabled, it uses :cstag whenever :tag, <C-]>, or vim -t is used. :cstag will use a cscope database if present, but if not it falls back to :tjump.


As far as why you see it on one system and not another, I'm pretty sure CentOS (and possibly RedHat) enable 'cscopetag' by default in the system vimrc.

1

You can map the Ctrl-] command so that it uses the :tselect command instead of :tag:

:noremap <C-]> :execute ":tselect " . expand("<cword>")<CR>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.