Hot answers tagged

15 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 ...
Sato Katsura's user avatar
  • 3,999
9 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.
romainl's user avatar
  • 39.3k
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! "\<<...
joeytwiddle's user avatar
  • 3,592
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. "...
Rich's user avatar
  • 31.3k
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". ...
romainl's user avatar
  • 39.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 ...
hgiesel's user avatar
  • 1,924
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 ...
Feng Yu's user avatar
  • 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 ...
Luc Hermitte's user avatar
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 ...
garyjohn's user avatar
  • 6,284
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 ...
romainl's user avatar
  • 39.3k
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 ...
romainl's user avatar
  • 39.3k
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 ...
Yegappan Lakshmanan's user avatar
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 ...
the_velour_fog's user avatar
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; ...
Feng Yu's user avatar
  • 659
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 ...
romainl's user avatar
  • 39.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 ...
Mass's user avatar
  • 14k
3 votes
Accepted

How to select the tag to open when several tags have the same name?

You can use :tnext to jump to the next matching tag. If you have four tags foo, these commands will let you jump to each tag sequentially: $ vim -t foo :tn :tn :tn You can use :tp[revious] to jump ...
romainl's user avatar
  • 39.3k
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 ...
mMontu's user avatar
  • 6,600
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 ...
Cometsong's user avatar
  • 571
3 votes
Accepted

How to get rid of "Press ENTER or type command to continue"

Could you try the following. It directly uses :tag and :tjump instead of using the mappings. I also removed the unneeded execute ... stuff. function! Jump(type) if filereadable(".tags") ...
Ralf's user avatar
  • 9,097
3 votes

navigating markdown documents using ctags with vim and neovim

A simple approach (that fails if you have embedded code comments) is to do something like global/^#/# And then type : and the displayed line number of the match you want. You could assign the ...
D. Ben Knoble's user avatar
  • 25.4k
3 votes
Accepted

Jump to definition (CTRL-]) slow on windows

search tag through a 1.6G tags file, I got immediate result with MacVim while surfering about 5s to get search result from NeoVim. From the symptoms you describe, it seems to me that you're getting ...
filbranden's user avatar
  • 28.4k
3 votes
Accepted

Vim function : how to expand vim variable in shell command?

The :execute command will assemble an Ex command from strings and evaluate it. Here, in this case, it's actually breaking your command, since it's expanding the g:projectRoot string and forming a ...
filbranden's user avatar
  • 28.4k
2 votes
Accepted

Enable completion for CSS using ctags

The problem comes from the leading dot before class names. Your search pattern leaves it out but you add it afterwards and, because tag search honors your iskeyword setting which doesn't contain ., ...
romainl's user avatar
  • 39.3k
2 votes

Can I load different tags per project?

You can use my project-tags plugin for this. It requires a tiny bit more setup than the fugitive.vim approach, but it is also more of a power user tool. Once you set it up for your projects, it will ...
still_dreaming_1's user avatar
2 votes
Accepted

How can I know function definition in vim for C?

If you have ctags installed then save the file(type :w) and regenerate the ctags by ctags -R filename then <Ctrl-]> to go to the function definition.
alhelal's user avatar
  • 659
2 votes

Alternatives to ctags: are rtags, uctags or other alternatives better?

On SO, I've written recently about uctags: Regarding C++, it makes the difference -- I can't tell regarding C or Java. It has a better understanding of C++ code bases than exuberant ctags. ...
Luc Hermitte's user avatar
2 votes

Ctags not working properly on Latin american keyboard

set tags=./tags means "path of the current file" not necessarily the current directory. The vim default set tags=./tags,tags would look in both path of current file and current directory. You can ...
Mass's user avatar
  • 14k
2 votes

use only "closest" tagfile to working directory (of buffer or of vim process)

I recently addressed this problem by writing a Vimscript function (tested and pasted below) that walks up the directory tree from the current file and sets as the tags file the first file named "tags" ...
Carl Smith's user avatar
2 votes
Accepted

^] doesn't work if cursor is on a function name prefixed with its package in Perl

Thanks I have figured it out. Instead of a plain ctags -R, run ctags -R --extra=+q which also adds the prefix-ed version of the methods into the tags file.
Sunny Pun's user avatar
  • 472

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