0

I am writing neovim help documentation for a plugin I am developing that reads as follows.

project.txt

*project* description

...

=================================================================================
CONTENT                                                    *project*

    1. Introduction                                        |project-introduction|
    2. Quickstart                                          |project-quickstart|
    3. Commands                                            |project-commands|
    4. Configuraion                                        |project-configuration|

=================================================================================
 1. INTRODUCTION                                            *project-introduction*

...

=================================================================================
 2. QUICKSTART                                              *project-quickstart*

...

=================================================================================
 3. COMMANDS                                                *project-commands*

...

=================================================================================
 4. CONFIGURAION                                            *project-configuration*

...

tags

project project.txt /*project*
project-introduction    project.txt /*project-introduction*
project-quickstart  project.txt /*project-quickstart*
project-commands    project.txt /*project-commands*
project-configuration   project.txt /*project-configuration*

I found that I can only jump to project, project-commands and project-configuration, but not to project-introduction and project-quickstart.

I tried cat to print ANSI characters:

$ cat -A doc/tags
project^Iproject.txt^I/*project*$
project-introduction^Iproject.txt^I/*project-introduction*$
project-quickstart^Iproject.txt^I/*project-quickstart*$
project-commands^Iproject.txt^I/*project-commands*$
project-configuration^Iproject.txt^I/*project-configuration*$

I'm using <TAB> correctly, without converting it to a space.

But I really don't understand why there is a problem that some titles cannot be jumped.

============================== Replenish ==========================

When neovim jumps to the help document, the error message given is as follows:

:help project-introduction
E426: tag not found: project-introducion@en

neovim version: 0.8.2

3
  • 1
    did you run :helptags Jan 27, 2023 at 8:27
  • @ChristianBrabandt I tried :tag project-commands and it redirected successfully, but :tag project-introduction still doesn’t work.
    – aszswaz
    Jan 27, 2023 at 8:42
  • sorry, I don't follow. How did you create the tags file? Did you not run :helptags command? Jan 27, 2023 at 11:22

1 Answer 1

0

My problem is solved: the reason is in the tags file, but it is not a grammatical error. Let me show the correct ANSI characters of the tags file directly:

project^Iproject.txt^I/*project*$
project-introduction^Iproject.txt^I/*project-introduction*$
project-quickstart^Iproject.txt^I/*project-quickstart*$
project-commands^Iproject.txt^I/*project-commands*$
project-configuration^Iproject.txt^I/*project-configuration*$
$

The key is at the end of the file, there must be two newlines.

If there is only one newline character at the end of the file, only the first and last two tags are valid, and other tags are invalid.

I don't know the reason for the time being. In addition, I found that the help documents in the plug-ins developed by others do not have two newlines at the end of the file, but their documents can be used normally.


I have been manually writing tags before, according to @Christian Brabandt's tip, (neo)vim has a :helptags <dir> command to automatically generate tags files.

5
  • How did you create the tags file? You should run :helptags to have vim create it properly Jan 27, 2023 at 11:23
  • @ChristianBrabandt Thanks for the reminder, I always thought you were telling me to run :help tags to see the manual.
    – aszswaz
    Jan 27, 2023 at 12:00
  • @ChristianBrabandt I have been manually writing the tags file before, I used cat -A tags to compare, the tags file automatically generated by :helptags is almost the same as the tags file I wrote manually, do you know the reason?
    – aszswaz
    Jan 27, 2023 at 12:03
  • I don't know why. I would always have vim generate the tags file. That has always worked for me and the helpfiles I have written Jan 27, 2023 at 12:04
  • Hi @aszswaz if this solution solves your problem maybe could you accept your answer to make the question rest. You can do that using the v green button next to the arrow voting buttons. You can accept your own answers two days after you post it. Feb 26, 2023 at 20:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.