documenting my own plugins?

16 views
Skip to first unread message

Jose Caballero

unread,
Jun 10, 2023, 11:45:08 AM6/10/23
to vim use
Hi,
apologies if this is a silly question.


I am trying to write documentation for my plugins in the ~/.vim/ftplugin/foo/ directory.
This is what I have tried:

1) created  ~/.vim/ftplugin/foo/doc/
2) created file ~/.vim/ftplugin/foo/doc/testfoo.txt with content

*testfoo* this is a test

3) :helptags ~/.vim/ftplugin/foo/
4) But when I try 

:help testfoo 

it doesn't work.

What am I missing?


Thanks a lot in advance. Any tip is more than welcome.
Cheers,
Jose

Gary Johnson

unread,
Jun 10, 2023, 1:51:44 PM6/10/23
to vim use
On 2023-06-10, Jose Caballero wrote:
> Hi,
> apologies if this is a silly question.
>
>
> I am trying to write documentation for my plugins in the ~/.vim/ftplugin/foo/
> directory.
> This is what I have tried:
>
> 1) created  ~/.vim/ftplugin/foo/doc/
> 2) created file ~/.vim/ftplugin/foo/doc/testfoo.txt with content
>
> *testfoo* this is a test
>
> 3) :helptags ~/.vim/ftplugin/foo/
> 4) But when I try 
>
> :help testfoo 
>
> it doesn't work.
>
> What am I missing?

I don't know for sure--I haven't tested this--but ":help
add-local-help" uses as an example,

:helptags ~/.vim/doc

Note that that path ends with the doc directory. So try this:

:helptags ~/.vim/ftplugin/foo/doc

HTH,
Gary

Jose Caballero

unread,
Jun 10, 2023, 2:15:59 PM6/10/23
to vim...@googlegroups.com
Hi

Actually, yes, that's what I tried ( :helptags ~/.vim/ftplugin/foo/doc/ ). I typed it wrong in my first post.
But not working.

Sorry for the confusion.

Cheers,
Jose

Gary Johnson

unread,
Jun 11, 2023, 12:37:14 PM6/11/23
to vim...@googlegroups.com
On 2023-06-10, Jose Caballero wrote:
>
Another thing is that doc directories all have to be in directories
in 'runtimepath'. So, you could either add ~/.vim/ftplugin/foo to
your 'runtimepath', or probably better, move testfoo.txt file to
~/.vim/doc.

Regards,
Gary

Jose Caballero

unread,
Jun 11, 2023, 3:49:34 PM6/11/23
to vim...@googlegroups.com
that may be it.

Thanks a lot.
Jose

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20230611163637.GB21417%40phoenix.

Jose Caballero

unread,
Jun 12, 2023, 4:43:13 AM6/12/23
to vim...@googlegroups.com
Indeed, this worked:

      :set runtimepath=~/.vim/ftplugin/foo,$VIMRUNTIME

I assume I can add it to .vimrc, so I don't need to do it every time. 

Thanks a lot for your help !!!
Cheers,
Jose

Gary Johnson

unread,
Jun 12, 2023, 12:25:09 PM6/12/23
to vim...@googlegroups.com
On 2023-06-12, Jose Caballero wrote:
> Indeed, this worked:
>
>       :set runtimepath=~/.vim/ftplugin/foo,$VIMRUNTIME
>
> I assume I can add it to .vimrc, so I don't need to do it every time. 
>
> Thanks a lot for your help !!!

You're welcome. I'm glad that worked.

By default, 'runtimepath' contains more that just $VIMRUNTIME,
though. as you can see from ":help 'runtimepath'". If you want to
put ~/.vim/ftplugin/foo in your 'runtimepath', then a better
solution would be this:

:set runtimepath+=~/.vim/ftplugin/foo

or, if you want your directory to be first, this:

:set runtimepath^=~/.vim/ftplugin/foo

And yes, you can put that in your vimrc.

Regards,
Gary

Bram Moolenaar

unread,
Jun 12, 2023, 4:18:20 PM6/12/23
to vim...@googlegroups.com, Jose Caballero

> Indeed, this worked:
>
> :set runtimepath=~/.vim/ftplugin/foo,$VIMRUNTIME
>
> I assume I can add it to .vimrc, so I don't need to do it every time.

Although this works, the "normal" way is to put your foo.txt help file
in ~/.vim/doc.

An alternative is to use packages, see ":help package-create". This has
the advantage that related files for the "foo" plugin are under one
directory. That matters if you want to move the plugin.

--
hundred-and-one symptoms of being an internet addict:
156. You forget your friend's name but not her e-mail address.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Jose Caballero

unread,
Jun 13, 2023, 4:24:28 AM6/13/23
to Bram Moolenaar, vim...@googlegroups.com
I think using ~/.vim/doc/ is cleaner than ~/.vim/ftplugin/foo/doc
Thanks a lot for all your help.

Cheers,
Jose
Reply all
Reply to author
Forward
0 new messages