Reading PHP Pages in Vim

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

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

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

It works fine, sometimes. Some features display manual pages just as you would expect. Others, I get the error "I can not find" method_exists ".", For example. First, I wondered if the manual pages were outdated, but that doesn't look like they are.

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

Does anyone know why only some of the manual pages display correctly inside Vim?

Thanks!

+6
source share
2 answers

I found that pressing K would display man pages for some keywords just because these keywords also had related pages. I did not check the man page close enough to notice that this is not for the PHP keyword.

I needed to point out a personโ€™s path before this worked correctly. I updated the lines in ~/.vimrc as follows:

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

Thanks for the help and suggestions!

+2
source

This may be the difference between a word and a WORD. See :help <cword> compared to <cWORD> . However, you cannot always use WORD, so instead, you may need to visually select the selection keyword first, and then press K

0
source

Source: https://habr.com/ru/post/925071/


All Articles