As of May 31, 2023, we have updated our Code of Conduct.

Hot answers tagged

18 votes
Accepted

How to go to function or class definition in current file

You don't necessarily have to install a plugin like ctags (although this would be reliable and allow many more great features, because you have semantic knowledge of your code, of course). Vim has a ...
Philipp Moers's user avatar
12 votes
Accepted

Tag navigation using CTRL+] does not work with Non English keyboard on Windows

Say hello to knowledge fragmentation: https://stackoverflow.com/q/6932702/520162 This question was already asked and answered on StackOverflow. The key is to press CTRL and the key that is located ...
eckes's user avatar
  • 246
10 votes
Accepted

How to search multiple occurences of a vimwiki tag?

The results from :VimwikiSearchTags are populated in the location-list window, so you can navigate using :lnext and :lprevious, or you can check all the results using :lopen. To be honest, despite I ...
mMontu's user avatar
  • 6,550
10 votes
Accepted

How can I close the quickfix window and go back to the file I was editing

To close the quickfix window, you use :cclose, as @statox mentioned in the comments. This won't affect which code buffer you're viewing, though. Vim doesn't distinguish between the buffer you were ...
Rich's user avatar
  • 30.4k
8 votes
Accepted

What does "tag" mean in the context of Vim's help window?

The tag is useful for two things: When using the :help command, the tag is the exact phrase which will let you distinguish between similar terms. {...
muru's user avatar
  • 24.5k
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, ...
TankorSmash's user avatar
8 votes
Accepted

Set path to location of tags file

let &path += fnamemodify(tagfiles()[0], ':p:h') should add the path of your tags file's parent directory to the path option. Updating path each time you enter a buffer is probably a good idea: ...
romainl's user avatar
  • 37k
7 votes

How do I navigate to topics in Vim's documentation?

-0.1 make notes about vim in a file. Use it as reference and container. fast way to find vim help of key | :cmd | 'option' | etc :h gi or :h g; for gi or g; in normal mode :h ^i for Ctrl-i in normal ...
qeatzy's user avatar
  • 940
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,894
7 votes
Accepted

ctrl-] does not work for tags consist of special character ( operators in haskell )

ctrl-] uses the word under the cursor, (as opposed to a WORD) which means that any punctuation is excluded. From :h word: A word consists of a sequence of letters, digits and underscores, or a ...
Tumbler41's user avatar
  • 7,646
7 votes
Accepted

What does a semicolon mean in the tags option

The answer for this is :h file-searching: 11. File Searching file-searching {not available when compiled without the |+path_extra| feature} The file searching ...
muru's user avatar
  • 24.5k
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
  • 30.4k
6 votes

How to set the opening file as the tags in vim?

The g:current_file is evaluated in your ~/.vimrc at startup, i.e. before any file has been loaded. You need to do the evaluation inside the :autocmd; either with :execute, but for options, it's more ...
Ingo Karkat's user avatar
  • 17.4k
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....
FDinoff's user avatar
  • 1,936
5 votes

How to go to function or class definition in current file

You will have to use a program like ctags to generate a tag file. It is recommended to use exuberant ctags. Once you installed this program, go to the root directory of you project in a shell and ...
statox's user avatar
  • 48.5k
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
  • 37k
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 ...
ZeroKnight's user avatar
  • 1,051
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
  • 37k
5 votes

Navigate to tag in a new tab if not already opened, like `tab drop`?

Put this in your vimrc: map <C-]> :TabExpand 1<CR> command -nargs=1 TabExpand call HandleTabTagExpand( <f-args> ) let s:commentchar = """ function HandleTabTagExpand(tagnumber) ...
Tim's user avatar
  • 426
5 votes

How to browse tags when autochdir is set?

Workaround Since the problem happens because of relative paths in tags file, it will go away if there are only absolute paths. ctags has --tag-relative option, which: Indicates that the file paths ...
xaizek's user avatar
  • 1,708
5 votes
Accepted

difference between marks and tags?

Both specify certain points in a file and give you commands to jump there and as such they are the same. But marks are created by vim. Either explicitly by hand with m or automatically by vim (for ...
Lucas's user avatar
  • 1,579
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
5 votes

How do I jump to tags instead of lines?

There are probably better ways but you could the help functionality as long as the filetype being help is ok. I basically use it to write down things I'm learning as I keep learning how to use gvim, ...
Steve's user avatar
  • 278
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 ...
romainl's user avatar
  • 37k
4 votes

Ctrl-] to open relevant help straight from .vimrc

I think the functionality you want is very useful, but it is already provided with the K mapping. This runs a program to lookup the keyword under the cursor. By default, it uses man. You can set it to ...
Karl Yngve Lervåg's user avatar
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
  • 37k
4 votes
Accepted

How do I automatically generate a tags file with ripper-tags for ruby?

Disclaimer: I don't have ripper-tags installed, this is my best guess on browsing the documentation. In the documentation it says that the typical usage is: ripper-tags -R --exclude=vendor This ...
Tumbler41's user avatar
  • 7,646
4 votes

Suppress "Using tag with different case" message

According to my reading of the code you've found the only way to avoid that stuff: use of silent. This appends the warning...nothing can prevent it except for disabling ignorecase et al... if (ic) ...
B Layer's user avatar
  • 19.1k
4 votes
Accepted

How do you :tag: every word of a line using substitution?

While on the line in question: :s/\w\+/:&:/g Breakdown \w\+ will match 1 or more word characters ([0-9A-Za-z_]). & has a special meaning in a replacement, depending on the value of 'magic' (...
Jake Grossman's user avatar
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,550

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