0

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 the tags file to the one for the help/doc.

Now it does work for most tags, but i noticed that some tags just won't work when used with CTRL-]. Example:

*E426* "works
*:ta*  "E426: tag not found: ta
*:tag* "doesn't work, goes to *tag* instead of *:tag*
*tag*  "works

As seen in the example above, some just doesn't work. Though, they do work fine when used with the :h or :help command.

And yes, i did check in the tags file previously mentioned (which can be found at $VIMRUNTIME/doc/tags) if the non-working tags were present, and they were (not surprising since they do work with the ex command :help and it's variation, but not on this specific case).

I did :helptags $VIMRUNTIME/doc just to make sure and compared the hash of the new and old one, though they were the same, so problem likely isn't coming from that.

I'm also aware of existing solution like VimNotes or helplink.vim but:

  • The former would require me to use help file structure, which i prefer not to (compared to the workflow previously described that wouldn't require me to use any special/specific filetype or template).
  • The latter would only link to generated urls of the docs in different templates.

Using Vim 8.2, compiled Oct 26 2020, Including all features.

Anyway, I'm a bit lost as to why it doesn't work for the specified tags in my previous example. Any input appreciated.

2
  • 2
    <c-]> is not quite the same as :help, which usually accepts abbreviations. It’s more the equivalent of :tag which, afaik, needs the whole match. (Try :tag :ta, see if that’s different from :help :ta.) Note that you can set keywordprg to :help so that K works almost like you want. – D. Ben Knoble Oct 30 '20 at 13:21
  • Thanks for your answer! :tag :ta as a ex command works just about the same as :help :ta when used inside/with the previously mentioned examples. As for using keywordprg, I tried doing setl keywordprg=:help and, noticed that using K now only work on *:ta* but not on *:tag* (still put cursor on *tag* instead) :/ @D.BenKnoble – Nordine Lotfi Oct 30 '20 at 22:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.