Hot answers tagged

21 votes
Accepted

Can I jump to a function declaration or definition in a multiple C++ source files project?

Exuberant ctags is the simplest way to achieve this. Under GNU/Linux (e.g. Ubuntu or Debian) you should be able to just do sudo apt-get install exuberant-ctags (For OSX "$ brew install ctags" ...
  • 396
15 votes

Can I load different tags per project?

This line should be enough: set tags=./tags;,tags; It tells Vim to look for a tags file in the directory of the current file as well as in the working directory, and up, and up, and…
  • 33.3k
14 votes

How to jump to function call?

You can't jump to function calls with ctags. For C/C++ and Java there is cscope, and it integrates nicely with Vim (see :help cscope). For other languages you might be able to find a tool that ...
  • 3,889
13 votes
Accepted

Can I load different tags per project?

If each project is a separate git repo, one can use fugitive.vim which will automatically point tags at .git/tags, allowing easy per-project tags.
9 votes

How to jump to function call?

You could use Vim's grep command to search all the files in your project: :grep! "\<<cword>\>" . -r :copen Let's put that in a keybind: nnoremap <F4> :grep! "\<<...
  • 3,492
8 votes
Accepted

Why can't vim see the tags file, despite being in the same directory?

wildignore had a trailing comma. My vimrc had set wildignore=*.png, which had a trailing comma. Changing it do set wildignore=*.png solved my issue. It turns out, after looking at :set for a while, ...
8 votes

How to jump to function call?

You can't do that with ctags. Try a beefier alternative like cscope (which even has its own help section: :help cscope) or global.
  • 33.3k
7 votes
Accepted

Jumping from function definition tag to prototype tag

Okay I've done it: It all has to do with ctags: First create two files called foo.c and foo.h to test it: In foo.h write down: int bar(void); In foo.c write down: int bar(void) { /* */ } And in ...
  • 1,844
7 votes

Mapping ctags keys

There are q few misconceptions here: "Hotkey" is not a thing in Vim. You have "commands", "mappings", "abbreviations"… but no "hotkeys". <C-]>, <C-t> and :tselect are all "commands". ...
  • 33.3k
7 votes
Accepted

why ctags take me to class definition rather than actual file

What's happening When there are multiple matches for a tag, Vim uses the following list of priorities (listed at :help tag-priority). "FSC" A full matching static tag for the current file. "...
  • 28.9k
6 votes

Is there a way to hook ctag changes to git branch checkouts and pulls?

Depending on how you update your ./tags file: If you do not commit your ./tags file to your branch/repository you can use a git hook that calls ctags -R . on each pull/checkout you do - this way your ...
  • 396
6 votes
Accepted

Vim, lua and ctags

<c-]> only looks at the keyword under the cursor. Normally : is not defined as a keyword character. To define : as a keyword character you can put setlocal iskeyword+=: in ~/.vim/ftplugin/lua....
  • 1,896
6 votes
Accepted

Exuberant Ctags - Duplicate tags problem

As @romainl said, It is indeed an FS(file system) case-sensitivity issue. My project file is mounted from Window 7 to my Fedora using: mount {Windows 7 Dir} {Fedora Dir} /local_folder -t cifs -o ...
  • 659
6 votes
Accepted

Plugin to display a smarter method tag list

I cannot provide an answer different to the one I gave in other similar questions. While tag-based plugins may present a complete list of existing overloads in a way much more ergonomic than :tselect ...
  • 16.2k
5 votes
Accepted

Adding ctags for a 3rd party library

You could use this to tell Vim to look recursively for tags files under /usr/include/: set tags+=/usr/include/**/tags For the generation part, I'm afraid you will still have to generate tags files ...
  • 33.3k
5 votes
Accepted

Navigation with Tagbar

A variety of methods are at your disposal There are some very useful commands listed here, most notably [I, which will display all lines in the current and all included files containing the keyword ...
5 votes

Jump to the definition in a scss file

gf The default $VIMRUNTIME/ftplugin/scss.vim sources $VIMRUNTIME/ftplugin/sass.vim which already sets everything for you to do gf over avatar and jump to avatar.css: setlocal suffixesadd=.sass,.scss,...
  • 33.3k
5 votes
Accepted

Why do I get the "tag stack empty" error when using :ptag and other commands?

First, the command to jump to a tag is <C-]>, not ]. Second, :ptag doesn't care about the word under your cursor. It works just like :tag but uses the preview window instead of jumping directly ...
  • 33.3k
5 votes
Accepted

Ctags force prompt on ambiguous tag

g<C-]> will display a list of tags only when there is more than one, so you could just train yourself to type g<C-]> instead of <C-]>. But having to type two characters instead of ...
  • 5,964
5 votes
Accepted

quickfix Menu Usage With :tselect and :vimgrep

You can use the ":ltag" command which adds the matching tags to the location list for the current window. You can then use the location list commands to browse the matches. BTW, the location list ...
4 votes
Accepted

Is it possible to get tag navigation that works with RequireJS?

Built-in definition search Vim is able to follow "includes" for completion and for navigation. What constitutes an "include" can be defined with the 'include' option. Sadly, Vim's include mechanism ...
  • 33.3k
4 votes

Can I jump to a function declaration or definition in a multiple C++ source files project?

So far I can name two solutions to the problem of finding either the declaration or the definition of a function. I know there is another well know tags based solution, but as I don't use it, I'll let ...
  • 16.2k
4 votes
Accepted

Exuberant Ctags: CTRL-] and ":tag" went wrong

To see all the files that Vim sourced during launch, I typed :scriptnames. I found that: When launching vim with the command $vim --noplugin or $vim, there is a /etc/vimrc file which is sourced; ...
  • 659
4 votes

How to view javascript tags in vim using tagbar + jsctags + tern_for_vim + ctags_exuberant?

:g/func/# gives you an actionable outline of the current JavaScript buffer without installing any third party plugin or requiring any external program. Use func\|var to include variable declarations....
  • 33.3k
4 votes
Accepted

Generate ctags for bash variables?

based on the prompt from @Cometsong I added wrote the regex expression below and added to my ~/.ctags --regex-sh=/^[ \t]*(local)?[ \t]*([A-Za-z0-9_-]+)=/\2/v,variable,variables/ So far it seems to ...
4 votes

Vim, ctags and overloading

The documentation (:help ctrl-]) says: When there are several matching tags for {ident}, jump to the [count] one. When no [count] is given the first one is jumped to. g] may not be what you are ...
  • 33.3k
4 votes
Accepted

ctags vs GNU id-tools?

The vim help alludes to the primary distinction as follows But sometimes you wish you could jump to all the places where a function or variable is being used. tags can be only used to jump to where ...
  • 12.9k
3 votes
Accepted

Search for tags with prefixes in other language files

You could use a mapping from Ctrl+] to a custom function, similar to the one described at :help CursorHold-example: A nice addition is to highlight the found tag, avoid the ":ptag" when there is no ...
  • 6,470
3 votes

Generate ctags for bash variables?

A regex can be built to find variable declarations like [A-z]…=[A-z0-9] Another for variable usage to include a \$ in the front My own yaml-specific .ctags example is: --regex-c=/^( YAML langdef ...
  • 571
3 votes

Can I jump to a function declaration or definition in a multiple C++ source files project?

There are few alternatives. The first one is ctags. If you need a more advanced indexer then cscope is a better alternative. For instance it will allow you to list all callers of given function. These ...
  • 915

Only top scored, non community-wiki answers of a minimum length are eligible