6

I have setup the ability to read the PHP manual via pman as described here: http://bjori.blogspot.com/2010/01/unix-manual-pages-for-php-functions.html

In my .vimrc file I have added the following so I can press K to read the man page in a new split window.

source $VIMRUNTIME/ftplugin/man.vim
nnoremap K :Man <cword><cr>

This works perfectly, sometimes. Certain functions show the man pages just as you would expect. Others, I get the error "Cannot find a 'method_exists'.", for example. First, I wondered if the man pages were out of date but it doesn't seem as they are.

If I run pman method_exists from the terminal, I see the expected man page.

Does anyone have any idea why only some of the man pages appear correctly inside of Vim?

Thanks!

Ben
  • 54,723
  • 49
  • 178
  • 224
jayem
  • 229
  • 2
  • 11

2 Answers2

3

I have found that when pressing K would show man pages for some keywords only because those keywords also had man pages associated. I didn't inspect the man page close enough to notice that it wasn't for the PHP keyword.

I had to specify the man path before this would work properly. I have updated the lines in my ~/.vimrc to the following:

source $VIMRUNTIME/ftplugin/man.vim
nnoremap K :Man --manpath=/usr/share/doc/php5-common/PEAR/pman/ <cword><cr>

Thanks for the help and suggestions!

jayem
  • 229
  • 2
  • 11
0

It could be the differentiation between a word and a WORD. See :help <cword> versus <cWORD>. However, you may not always want a WORD, so you may instead need to resort to first visually selecting the selection keyword and then pressing K.

Conner
  • 30,144
  • 8
  • 52
  • 73
  • I will have to read about the differences between `` and ``. I'm a bit confused though, in both cases, the function is lowercase. – jayem Sep 11 '12 at 07:00
  • @jayem it doesn't have to do with lowercase/uppercase, but instead the underscore. – Conner Sep 11 '12 at 13:28
  • I'm not sure if it is because of the underscore because the man page for `htmlentities` does not function properly either. I have also tried `` instead of `` with no difference. Lastly, selecting the word in visual mode, then using `K` doesn't work either. – jayem Sep 11 '12 at 15:16
  • I'm starting to wonder if some of the man pages are shown as expected because the keyword exists in other man pages (example: `date`). When I perform `:Man -w date` inside of Vim, I get `/usr/share/man/man1/date.1.gz` where as with `pman` it is `/usr/share/doc/php5-common/PEAR/pman/man3/date.3.gz`. – jayem Sep 11 '12 at 15:49