Wednesday, March 30, 2011

Re: Hyperlinks with dashes not working

On Wed, 30 Mar 2011, Marco wrote:

> I have some troubles creating help files with dashes in the
> hyperlinks. When a dash appears in a hyperlink, vim consideres the
> parts to be independent words. Dashes in the help files shipped with
> vim are no problem, this happens just to my own ones.
>
> Example:
>
> |my-helptopic|
>
> *my-helptopic*
>
> In the link above I either get: »E426: tag not found: helptopic«
> or »E426: tag not found: my«
>
> I suspect a misconfiguration somewhere in my system. How to get links
> with dashes working?

Do hyperlinks *without* dashes work in the same file? I got the same
errors before I did the following two things:

1. Put the help file in a subdirectory of your 'runtimepath' appended
with 'doc'

So, if :se rtp? returns:

runtimepath=~/.vim,/usr/share/vim/vim73,~/.vim/after

In order to be found as a *help* tag, the file would need to be in one
of these directories:

~/.vim/doc
/usr/share/vim/vim73/doc
~/.vim/after/doc

(The first one is the obvious recommendation.)


2. Build the help tags index for that file using the :helpt[ags]
command.

If your file is in ~/.vim/doc, call it as:

:helpt ~/.vim/doc


Doing both of those things seemed to fix the problem for this sample
file:

==> ~/.vim/doc/helptest.txt <==
Dest for *asdf-fdsa*
Link to |asdf-fdsa|

Dest for *abcd*
Link to |abcd|

Dest for *efgh*
Link to |efgh-XXXXXXXX|
Link to |XXXXXXXX-efgh|

The last two links show that Vim will fall back to splitting on hyphens
if the whole isn't found. Only works for the efgh portion of the
link... I guess the thought is that a plugin might forget to update a
link: e.g. |mypluginname-oldoption| still finds:
*mypluginname* even if there's no destination for the entire tag.
===============================

:e ~/.vim/doc/helptest.txt
:se ft=help bt=help
:helpt ~/.vim/doc
" after that, the links work

--
Best,
Ben

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment