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 ...
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 ...
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 ...
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 ...
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.
{...
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
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:
...
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 ...
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 ...
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
...
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 ...
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.
"...
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 ...
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....
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 ...
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 ...
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
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 ...
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)
...
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 ...
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 ...
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 ...
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, ...
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 ...
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 ...
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 ...
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 ...
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)
...
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' (...
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
tags × 93ctags × 29
help-system × 7
navigation × 6
search × 5
autocompletion × 5
filetype-c++ × 5
cscope × 5
vimrc × 4
key-bindings × 3
cursor-movement × 3
quickfix × 3
plugin-vimwiki × 3
regular-expression × 2
filetype-c × 2
jumplist × 2
plugin-tagbar × 2
plugin-easytags × 2
vimscript × 1
neovim × 1
gvim × 1
substitute × 1
microsoft-windows × 1
highlight × 1
plugin-system × 1