Questions tagged [tags]
Questions related to the use of tags files created by programs such as `ctags` to quickly locate language objects such as functions.
99 questions
0
votes
1
answer
49
views
How to set cursor position with tags file?
I am generating a tags file for m4 language. It works great, for example:
m4_symbol k/applyforeachq.m4 /\m^m4_define\w*(\_s*«\?\zsm4_symbol\>/;
m4_symbol2 k/foreach.m4 /\m^...
2
votes
2
answers
217
views
Identify the open tag file
I have set :set tags=./tags;$HOME to do an "upward search" for a tags file. How do I find out what file has actually been loaded?
0
votes
2
answers
41
views
<c-n><c-p> start to scan tags in insert mode whereas I just want to complete with existing words in the buffer
I found this issue while editing my .vimrc. I tried to do the same in other files, such as .txt and .sh with no problems.
While in insert mode, I use <c-p> for completing words that are in the ...
0
votes
1
answer
38
views
Wonder the scope of the output of the vim command :tags
When I invoke :tags command in vim, the result varies depending on vim windows.
So I wonder the scope of the result of the vim command :tags.
I guess it would be one of below:
g: Global
s: Script-...
1
vote
1
answer
97
views
What is CTRL-W Tab doing?
By pure coincidence, I hit CTRL+w and then Tab while editing a C++ file, and what happened is that the window was horizontally split and the new window loaded the buffer where the word under the ...
0
votes
1
answer
77
views
Convert some quickfix messages into tags rather than errors
Often times I get way too many diagnostics from my compiler (eg., things beginning note: which just provide context for the actual error), and I do not want to descend into these when I type :cn.
Can ...
2
votes
3
answers
108
views
Can we configure Vim tag following to be more intelligent?
In large code bases, there can be multiple hits for an identifier. Sometimes dozens. When you look up a tag, the first choice in the list is often some false positive you don't want.
The user ...
1
vote
1
answer
157
views
How do I open vim from the command-line at a particular tag?
I have set up ctags to generate a tags file for my code base. I can now jump to definitions of functions by running :tag FUNCTIONNAME or by pressing ctrl-] when my cursor is on the invocation of a ...
0
votes
0
answers
31
views
Tag file for CMake default keywords
Is there any distribution of docs and tags file for CMake default keywords?
eg. I want to jump to description of CMAKE_INSTALL_PREFIX or get_cmake_property() when viewing CMakeLists.txt.
2
votes
1
answer
83
views
PHP class name collision with ctags
I have the following php file:
namespace App\Validator;
use Symfony\Component\Validator\Constraint; // #1
class MyValidator // ...
{
public function validate(Constraint /* #2 */ $constraint): ...
1
vote
1
answer
319
views
How can I tag lines?
I would like to tag or annotate lines so that I can later refer to those lines and perform commands on them. I wouldn't like for the tag to be in the actual text but external metadata. Is there any ...
2
votes
1
answer
462
views
What is the difference between `tag` and `tags` command?
I've recently come across the concept of tags in vim. I run ctags on a file and it generates tags for that file.
When I try to access those tags I use the tag command which basically provides a list ...
3
votes
0
answers
81
views
I use vim for notetaking. Can I fold/filter to relevant notes by tag?
I use vim for notetaking. I use a simple format like this:
Friday, August 27, 2021 01:00 pm / tech leadership
What should our top priorities be? Monthly priority review.
Can we budget for continual ...
1
vote
1
answer
97
views
How to filter results in tagfunc?
I'm using Vim to edit Erlang source files. As function names in Erlang are only unique within a module (unlike in C), the tags support "out of the box" is not perfect (for example there are ...
2
votes
1
answer
89
views
Sorting `taglist()` output by order of appearance in the file
As a followup to https://vi.stackexchange.com/a/33176/4674, I found that taglist() output seems arbitrarily ordered (maybe alphabetical?).
Right now I'm using this function to get the list of all tags ...
1
vote
1
answer
308
views
How to cycle through all tags in the current file?
Sometimes I want to just loop through all tags in a file. One use case is for help files, but it's also useful for browsing large unfamiliar source code files.
Is there a way to do this? Something ...
0
votes
1
answer
264
views
Taglist isn't reading custom Markdown tags
The plugin Taglist is showing tags perfectly for my python but not for my markdown files.
There is a MCVE on github.
I have two files. test1.py is:
def one():
print("one")
def two():
...
0
votes
1
answer
123
views
What are the E tags in vim help?
I've been browsing vim's help and noticed there are some topics which have multiple E### tags and others with just a single E### tag. I'm curious as to what the significance of these E### tags are. My ...
1
vote
1
answer
159
views
Iterate through functions calls in various files
I can jump to a function definition thanks to :tjump.
Or I can search for a function call in a file with / but is there a way
to iterate through function calls across various files ?
If the solution ...
5
votes
2
answers
223
views
Code-review: persistent tag-stack display
Update: I've created a plugin.
I wrote a bit of code for a friend who's dealing with large C code-bases and using cscope/ctags to navigate around. He was hoping to get a persistent display of the ...
2
votes
1
answer
243
views
vim auto select tags upon launch
I have multiple projects (folders), and each of them has its corresponding tags generated.
I found every time I launch vim it only links to my first tags file (:set tags?), I need to manually set the ...
2
votes
1
answer
651
views
Vim :tag can jump to the tag but using short key ctrl+] gives cstag: tag not found
I have generated tags using ctags -R .
In Vim I'm able to find the tag when I type :tag TagName and it does jump to it.
However, if I have a cursor over the TagName and do Ctrl+] vim shows cstag: tag ...
0
votes
2
answers
149
views
Get file and line number for tag with name
I would like to make simple utility that opens tag under cursor in popup window introduced in recent vim version. Assuming I get word under cursor with command let l:word = expand("<cword>&...
0
votes
0
answers
155
views
CTRL-] keys not working with very specific tags
So, I'm trying to use vim's help tags in my notes files, so that i can easily reach them (without using ex command or making a new keymapping).
For that, i used:
set tags=$VIMRUNTIME/doc/tags
to set ...
0
votes
2
answers
126
views
How do you :tag: every word of a line using substitution?
How do you substitute every word of a line, so that it becomes a useful vimwiki tag?
Provided the following line:
Word Compund_Word
I want:
:Word: :Compund_Word:
I guess it involves some use of ...
2
votes
1
answer
445
views
Search for symbols in tags from multiple projects
I am developing a Linux kernel driver so I have a git directory with my project.
I have another git directory with the Linux sources.
I am using neovim with gutentags with the setting of gtags_cscope ...
3
votes
2
answers
48
views
Suppress "Using tag with different case" message
With ignorecase set, I am able to jump to a tag Foo by typing :ltag foo. However, doing so causes the message
Using tag with different case!
to appear at the bottom of the screen, along with a ~0.5s ...
1
vote
1
answer
40
views
Persistent tag highlights when changing between buffers
I've put following code in my vimrc.
function ExtraHighlights()
let list = taglist('.*')
for item in list
if item.kind == 's' || item.kind == 't' || item.kind == 'u' || item.kind == 'g'...
1
vote
2
answers
540
views
<C-x><C-o> "Pattern not found" even with a Ctags file (C/C++)
<C-x><C-o> returns Pattern not found in C/C++ files even with a ctags file.
It used to work and I haven't made any configuration/plugin changes that I know of
Starting vim with vim -u ...
2
votes
1
answer
718
views
Jump to definition (CTRL-]) slow on windows
I have a big source code base on both Mac and Windows on which I work on this with MacVim/NeoVim.
When using CTRL-] to search tag through a 1.6G tags file,
I got immediate result with MacVim while ...
1
vote
0
answers
60
views
How do I navigate using tags in a personal copy of the vim documentation?
As background: I am a beginner in VIM and I want to go through the built-in vim manual, but with my own copy (not the system copy) so that I can practice in the manual text as I go along (I also ...
0
votes
0
answers
13
views
"tnext" command skips to next file
I'm using vim's built in helptags command to create a tags file in LaTeX. While LaTeX files are not the txt files normally used, helptags seems to work just fine, and generates an empty "tags" file ...
6
votes
3
answers
1k
views
How do I jump to tags instead of lines?
I'm using vim as note-taking software. My notes grow to thousands of lines across 7 different files.
If I was writing code, I would be able to jump to a function definition in a different file ...
1
vote
0
answers
26
views
Jumping to tags instead of lines in a text-file opened by vim [duplicate]
I'm using vim as note-taking software. My notes grow to thousands of lines across 7 different files.
If I was writing code, I would be able to jump to a function definition in a different file ...
1
vote
0
answers
88
views
How to jump to or list a tag exclusively defined in a header?
I have a .h and a .cpp with declarations and definitions, and I'd like to be able to :tselect only the declarations, in order to see all the functions I've got that match a pattern.
some_file.h:
...
5
votes
1
answer
1k
views
Open quickfix Window Only, Don't Jump To First Result
Is there a way to open just the quickfix list without jumping to the first result when using :lt? I am using :lt to populate the location list with tags that match with the following binding:
nmap &...
1
vote
2
answers
1k
views
quickfix Menu Usage With :tselect and :vimgrep
I am currently using the following mapping to search for knows tags:
nnoremap <expr> <Leader>t "<ESC>:tselect /" . input("") . "<ESC>"
I also use this mapping to grep all ...
5
votes
0
answers
562
views
How to have gutentags build tags from the .git folder in a repository?
I want to have my tags file generated from gutentags/ctags to be in the .git folder, because I am working on a project with other people where I don't want to edit the .gitignore file. So, I have ...
3
votes
0
answers
146
views
Highlight tag matches for better visibility
When I search for occurrences of some frequent pattern (lets say finding a c symbol), I'll get a list of suggestions at the bottom of vim. Is there a way that the pattern is highlighted for easier ...
3
votes
2
answers
809
views
Why are helptags not shipped with plugins?
Part of the job performed by virtually all plugin managers in Vim is to create helptags, which will index the help files shipped with the plugins and will allow searching for commands and mappings ...
1
vote
1
answer
290
views
How do I open a tag in an existing gvim instance?
On windows I use gvim, and like to keep just one gvim instance running. Most of the time I open files like this:
gvim -p --remote-tab-silent FILES.
However, sometimes I want to open a tag in that same ...
6
votes
2
answers
12k
views
How can I close the quickfix window and go back to the file I was editing
I use gutentags and gutentags-plus for generating and managing tag files. When I use the key combinations setup by them ( cX usually ), it opens the relevant lines in a quickfix window and I can use :...
1
vote
0
answers
67
views
Ctrl-] matching single word in custom tags
When using vim's help I can jump to multi-word tags, but when creating my own tags Ctrl-] tries to match individual words. Consider the following example:
file.txt
|a-tag|
*a-tag*
When ...
0
votes
1
answer
2k
views
Setting a list of tag files
Is there a way to set multiple default tag files, to be searched sequentially in my vimrc? My hope was that I would be able to have a local tags file that would be searched first and then, if nothing ...
3
votes
1
answer
1k
views
vim can't process tags
I generated tags files and I'm using the following command in my .vimrc:
:set tags=./tags;
When I press Ctrl] I get the following error:
E433: No tags file
E426: tag not found: poll_wait
I'm not ...
1
vote
0
answers
682
views
Tag not found unless searched for
I have a very weird situation with my tags file not working as expected. My tag file is sorted case-insensitively (starts with !_TAG_FILE_SORTED\t2\t/foldcase/), and ignorecase is set.
When I put my ...
5
votes
1
answer
1k
views
difference between marks and tags?
Reading the manuals, seems to me that marks and tags are the same thing, only difference is that mark names can be [a-zA-Z] values, while tags can be alphanumeric. If I'm wrong, what is the difference ...
4
votes
2
answers
623
views
Make Ctrl-] give a list of matches to choose from instead of taking me to the first match
When the cursor is over a word that has multiple matches according to ctags, the Ctrl-] command on one machine I use gives me a list of matches to choose from, while on another it just populates the ...
5
votes
2
answers
2k
views
How To Use Tags In Vim For Notes
Backstory: So there is all these notes app like Evernote Onenote... but I do not want to be locked into a system and only are going to use my laptop. So I thought why not use vim to edit markdown ...
2
votes
1
answer
1k
views
why ctags take me to class definition rather than actual file
Background
I'm using vi with a php/laravel code base.. I ran ctags and see what happens:
filename: app/Http/Controllers/RetailerApproveController.php
use App\Repositories\ApproveOrderRepo;
...
...