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
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,610
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
  • 31.6k
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.8k
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
  • 960
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,736
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.8k
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,934
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.6k
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,758
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 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
  • 49.6k
5 votes

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

Regarding the question: how to follow hyperlinks? With the mouse cursor over the desired link do Ctrl + ]. Ctrl + t will bring you back to the initial outline with its list of links, where you can ...
alec's user avatar
  • 785
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
  • 40k
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,609
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
  • 276
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,736
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
  • 40k
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.7k
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

Warn before exiting if tag stack not empty?

There's no built-in option, but you can implement a custom command that either :quits or :pops the last item from the tag stack. command! QuitOrPop try | pop | catch /^Vim\%((\a\+)\)\=:E\%(73\|555\):...
Ingo Karkat's user avatar
  • 17.8k
3 votes

How to tag jump in new tab, if target file not in active tabs, else switch to exists tab?

Has vim built-in functions which can return a list of tab files? like :tabs command You'll have to do some parsing, but you can use let myVar = execute('tabs') for this. How to get tag's filename ...
Tumbler41's user avatar
  • 7,736
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
  • 40k
3 votes

How to navigate to template class member via tag command

There are (universal?) tags options that can request functions names to be prefixed by full scope (namespace + class). Unfortunately, I can't remember which one it is among: --c++-kinds=+f --fields=+...
Luc Hermitte's user avatar
  • 17.2k
3 votes
Accepted

How to search and jump to tag without going to window of tagbar?

Vim comes with a complete set of commands and options for using tags. You can read all about it in :help tags (the generic stuff) and :help ctags (the ctags-specific stuff that also applies to jsctags)...
romainl's user avatar
  • 40k
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,610
3 votes
Accepted

How to autocomplete tag names containing a colon?

I understand that you prefer to avoid changing 'isk' permanently, but what about changing it during the autocompletion? function! CustomComplTag() setlocal isk+=: call feedkeys("\<c-x>\&...
mMontu's user avatar
  • 6,610
3 votes

Bidirectional tag stack movement with cscope in vim

Ensure setting the cscope using the following in your ~/.vimrc file: set cscopetag set cst set csto=0 set tags=./tags,tags;/ cs add cscope.out Once it is done, re-login into the terminal to run ...
Vicky's user avatar
  • 131
3 votes

Why is ] used for tag navigation?

vi was designed for use with glass terminals, the protocols of which often use many of the control-x commands down at the low end of ASCII. Others were reassigned in the move from paper terminals, ...
Warren Young's user avatar

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