Binding PHP documenter script to <C-P> in Vim

半城伤御伤魂 提交于 2019-12-24 15:22:07

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!