VIM / NeoVim

Client Guides

Prerequisites:
  • Neovim 0.5.0 or higher.

  • nvim-lspconfig package (this contains common LSP configurations)

  • The phpactor binary is installed and executable in your path

For example: include it in your .vimrc with Plug:

Plug 'neovim/nvim-lspconfig'

Then enable it in your .vimrc. (note that on_attach is a callback which can be used for key bindings):

lua << EOF
require'lspconfig'.phpactor.setup{
    on_attach = on_attach,
    init_options = {
        ["language_server_phpstan.enabled"] = false,
        ["language_server_psalm.enabled"] = false,
    }
}
EOF

The init_options key maps directly to Phpactors Configuration.

Please refer to the nvim-lspconfig package for keybindings (also see :help lsp).

See NVIM LSP Configuration Snippets for useful snippets (e.g. reindex, show config, etc).

Troubleshooting

Two dollars on variables

This can happen because of the iskeyword setting in VIM.

You can try adding $ to the list of keywords to solve the problem:

autocmd FileType php set iskeyword+=$

or configure Phpactor to trim the $ prefix in .phpactor.json:

{
    "language_server_completion.trim_leading_dollar": true
}