Skip to main content
7 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
  • 17.7k
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
  • 32.4k
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
  • 41.8k
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
  • 41.8k
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,379
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

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
  • 29.6k
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
  • 14.2k
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
  • 27.3k
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,337
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
  • 41.8k
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
  • 29.6k
3 votes

PHP class name collision with ctags

<C-]> is equivalent to :tag <keyword>, not to :tselect <keyword>, the normal mode equivalent of which would be g]. The end result of $ ctags -R . is a tags file that contains a list ...
romainl's user avatar
  • 41.8k
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
  • 679
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
  • 17.7k
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
  • 14.2k
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

vim can't process tags

Your 'tags' setting should search for tags named tags in the current directory: When a file name starts with "./", the '.' is replaced with the path of the current file. But only when the 'd' ...
Ingo Karkat's user avatar
2 votes
Accepted

ctags for django templates

The issue you're having is that your tags are filenames with extensions (which include a ".") but searching for that tag using Ctrl-] is actually only looking for the base name of the file without the ...
filbranden's user avatar
  • 29.6k
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
  • 482
2 votes

Smart jump to definition

You didn't mention the language you're using with ctags, but in any case, you're most likely not calling ctags with the necessary flags to include namespace information. Support for each language ...
r_31415's user avatar
  • 576
2 votes

How to run external commands in vim from windows OS?

To run external commands from within vim on windows you should use the same vim commands you use for other OSes. :!dir :echo system('dir') Just to double check, cmd.exe that is used by default as a ...
Maxim Kim's user avatar
  • 13.8k
2 votes

ctags: can you ignore matching tags for a specific file extension?

(Disclaimer: I'm not the best at ctags but here is one solution I came up with on my own.) Solution: for each language generate one ctags tag file for each language tag file create a new vim ...
Trevor Boyd Smith's user avatar
2 votes

ctags cannot find the definition of a local variable in a c function

If you are using universal-ctags, pass --kinds-C=+l. $ cat /tmp/foo.c int main(int argc, char **argv) { int r = 0; retunr 0; } $ u-ctags -o - --kinds-C=+l /tmp/foo.c main /tmp/foo.c /^main(...
Masatake YAMATO's user avatar
2 votes

Is there a ctags option for vimscript?

I usually use the search in file functionality of Vim to find the definition of the function. To find the definition of MyFunction I would run the command: :vim "^fun.* MyFunction" Or using ...
Vivian De Smedt's user avatar
2 votes

What is CTRL-W Tab doing?

For historic reasons, <Tab> and <C-i> are indistinguishable in Vim (look up the ASCII table). When you pressed <C-w><Tab>, you actually pressed <C-w><C-i>, which is ...
romainl's user avatar
  • 41.8k
1 vote

Smart jump to definition

I recommend getting in the habit of (or changing your mapping to) :tselect instead of :tag if there are often multiple matches. The former gives you a menu from which to pick the correct tag.
D. Ben Knoble's user avatar
  • 27.3k
1 vote

Is it possible to have tag suggestion in ctags while searching for a tag?

You can use Ctrl+D in command-line mode, it shows you all the suggestions you would get with the Tab completion. e.g. :ta func<C-D> Apart from that, fzf plugin have a :Tags and CtrlP have :...
perelo's user avatar
  • 471
1 vote
Accepted

Jumping to prototype or definition of a function using tags

An alternative is g<C-]>, which lets one choose from multiple tag matches if they exists.
D. Ben Knoble's user avatar
  • 27.3k

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