I wonder what Vim Taglist is good for if I cannot jump to a tags definition from within an open source file. Do I have to generate a separate tags file by running, say, ctags *.f90, in order to be able to use Ctrl+]?

有帮助吗?

解决方案

Yes, you need a tags database (usually created by running ctags or an equivalent external tool) to use the tag jump / search functionality of Vim.

As Vim is a general-purpose text editor, it does not possess any knowledge about individual languages, and instead delegates (in true spirit of Unix's do one thing well mantra) this to an external resource.

PS: There are plugins like easytags.vim that automate the process of tags generation and update.

其他提示

What is this taglist you are talking about?

The only taglist I know of are:

  • the taglist() function (:h taglist()), which is of no use for you (or me) in your daily Vim usage,

  • and the TagList plugin.

Do you refer to the :tag family of commands?

<C-]> and :tag are used in conjunction with a tags file to jump to the declaration of a variable or method or whatever. If you have no tags file, <C-]> simply won't work.

The TagList plugin, uses ctags under the hood to build an actionable list of the elements present in your file(s) but it doesn't use a tags file: the result of the ctags command is consumed directly.

That means that you can perfectly have a working TagList plugin and a non-working <C-]> (and :tag, :tselect, etc…) at the same time. Those are separate features.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top