Vim PHP omni completion

前端 未结 9 1013
醉话见心
醉话见心 2020-12-07 12:44

I\'m trying to get PHP autocompletion right in Vim. Right now when I do a $blog = new Blog(); $blog-> and then hit CTRL+X CTRL+O I\'d expect omn

相关标签:
9条回答
  • 2020-12-07 13:01

    try

    curl -L -s https://git.io/ide | sh
    

    then relaunch your nvim. You might got code completion, and goto definition features.

    *Currently, it's only available for neovim

    0 讨论(0)
  • 2020-12-07 13:06
    " Assuming Vim 7 (full version) is installed,
    "   adding the following to your ~/.vimrc should work.
    
    filetype plugin on
    au FileType php set omnifunc=phpcomplete#CompletePHP
    
    " You might also find this useful
    " PHP Generated Code Highlights (HTML & SQL)                                              
    
    let php_sql_query=1                                                                                        
    let php_htmlInStrings=1
    
    " Hope this helps!
    

    (via http://www.linuxquestions.org/questions/linux-software-2/vim-omin-completion-for-php-621940/#post3155311)

    0 讨论(0)
  • 2020-12-07 13:12

    In C++, I run the following to get better context sensitivity:

    ctags '--c++-kinds=+p' '--fields=+iaS' '--extra=+q'
    

    It's not perfect, but after ctags adds the extra information to the tags file as specified by the above command vim handles completion better.

    0 讨论(0)
提交回复
热议问题