5

I have a few packages installed in my ~/.vim/pack/default/start directory, for example Tabular and Unicode. After starting up vim I can use these packages but cannot access their help information. Issuing helptags ~/.vim/pack/default/start/tabular.vim/doc doesn't resolve this; neither does helptags ALL.

I've been starting vim with the same session file (i.e. vim -S path/to/session.vim) for a few years. When I start vim without specifying a session file, I can access documentation for these packages. It would be nice to be able to keep my session and still access docs for packages but starting a new session is a usable workaround.

EDIT

Originally posted the below solution as an answer but for reasons unclear to me it was deleted. It's not optimal but it fixed my problem, unlike the only other posted answer.

I've been starting vim with the same session file (i.e. vim -S path/to/session.vim) for a few years. When I start vim without specifying a session file, I can access documentation for these packages. It would be nice to be able to keep my session and still access docs for packages but starting a new session is a usable workaround.

12

Using :helptags ALL should re-generate all helptags for all doc directories in runtimepath; which should include the ~/.vim/pack/default/start/* directories.

You will probably get an error similar to:

E152: Cannot open /usr/share/vim/vim81/doc/tags for writing

Which is safe to ignore. Vim will continue generating helptags after this error (check the output of :100verbose :helptags ALL if you don't believe me).

For adding packages in the opt directory as well, you can use (based on Peter Rincker's comment):

command! -nargs=0 -bar Helptags
    \  for p in glob('~/.vim/pack/bundle/opt/*', 1, 1)
    \|     exe 'packadd ' . fnamemodify(p, ':t')
    \| endfor
    \| helptags ALL
| improve this answer | |
  • 1
    In case you want helptags for opt directories as well. command! -nargs=0 -bar Helptags for p in glob('~/.vim/pack/bundle/opt/*', 1, 1) | exe 'packadd '.fnamemodify(p, ':t') | endfor | helptags ALL This assumes a path of ~/.vim/pack/bundle – Peter Rincker Aug 29 '18 at 17:28
  • Ah yes, I had forgotten that this excludes the opt directory. Amended the answer @PeterRincker; thanks! – Martin Tournoij Aug 29 '18 at 18:04
  • Whoops, forgot to mention that :helptags ALL didn't do anything. Still, if specifying the actual directory of the plugin also doesn't work, why would helptags ALL work? – intuited Sep 4 '18 at 19:16
  • This answer worked for me! I did however get two errors: 151: No match: /home/user/.vim/doc/** and E151: No match: /usr/share/vim/vimfiles/after/doc/**. I imagine it's because those are empty or don't exist? – FilBot3 Jun 3 at 13:02

Your Answer

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

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