问题
As suggested in an answer here:
VIM Insert PHPdoc automatically
I was trying to bind Ctlp to the PHP documenter script in order to generate comments.
I used these lines at the end of my .vimrc file:
" PHP documenter script bound to Control-P
autocmd FileType php inoremap <C-P> <ESC>:call PhpDocSingle()<CR>i
autocmd FileType php nnoremap <C-P> :call PhpDocSingle()<CR>
autocmd FileType php vnoremap <C-P> :call PhpDocRange()<CR>
But when I press Ctlp, the cursor goes to the line before and the comments are not generated.
However if I manually execute the command:
:call PhpDocSingle()
It works fine, so I know the php-doc.vim plugin is correctly installed and the problem is about the keyboard shortcut.
I've searched in my .vimrc file if there is any other binding to Ctlp, but I found none.
Any suggestions?
回答1:
<C-P>
and <C-p>
are different: you are mapping something to Ctrl+Shift+p but you are hitting Ctrl+p.
What happens when you hit Ctrl+Shift+p?
来源:https://stackoverflow.com/questions/12881340/binding-php-documenter-script-to-c-p-in-vim