The best NeoVim/Vim PHP autocomplete plugin by far
Ever since I started using VIM/NeoVim as my primary IDE for PHP development, I felt the need for better autocomplete, with methods, namespaces, go-to definitions and all the good stuff that big IDE's autocomplete systems like PHPStorm already have. Many times, I've tried and searched for a good php autocomplete plugin, but I've never managed to find one.
Basically 2-3 times per year I'm doing research for Vim PHP autocomplete plugins and every time I manage to find new ones that I haven't seen before and I get really excited to try them. Shortly after, however, I find that they are not what I expect. They break the editor, don't work right, or I generally dislike them. Then I go back to my old way of working, depending only on basic autocomplete offered by YouCompleteMe
Vim plugin.
Luckily, today, when searching for phpstorm autocomplete vim
this post came up How did I Replace PhpStorm by Vim in my Heart. This post is written by a PHP developer who previously used PHPStorm but successfully switched to Vim / NeoVim. He mentions all the plugins he uses, and from there I found the ncm2/ncm2 plugin and phpactor/phpactor.
ncm2 is an auto-completion engine. In addition, you'll need phpactor/phpactor which feeds data to the auto-completion engine and phpactor/ncm2-phpactor is the link between these two.
Today I'm starting to use this setup. Let's see how this goes... I'll write an update post in a few months to tell you if this plugin did the trick for me. :)
Update 3 Jan 2023 (precisely three years of usage)
The plugin so far does an excellent job for me. The author of phpactor frequently releases new versions, and the package overall has good support. I would definitely say go ahead with my approach and install ncm2
, Phpactor
, and ncm2-phpactor
for neovim php autocomplete (or vim autocomplete).
It seems that a lot of people use the Intelephense LSP library, so I've made a comparison post about Intelephense vs Phpactor.