I’ve been using Vim for years want to try out nvim and a bit confused. Can someone please assist me on how to set up a simple config with Lsp intelephense for php, commenting lines, show folds and fzf. I don’t know if it uses tag files created by ctags or phpctags but would like those to be generated or updated upon save or the buffers. Set up should be fly and require min dependencies.

I am on fedora 36 but can do centos 7 or Ubuntu. Please help me get started as this is a new concept for me but would like to start using it asap: the key bindings will have to adapt or try to carry the ones I have in Vim over.

  • 1
    In order to propose a similar experience could you tell us how you did configure Vim for php support. What are you using for LSP (coc.nvim)? What are you using for tag generation (gutentag)? I understand that you are using fzf in Vim. Are you using a package manager (vim-plug)? Commented Jun 6, 2023 at 16:09
  • Currently in vim I use coc but I think it’s too many unneeded items preloaded - I want it simple. I use phpctags to generate my tag files and cache them rebuilt upon save. T comment for comments, intelesence for lsp. I know there is a simple way to do it via nvim and lua but don’t see examples. For instance just to have a Tcomment plugin and have it keys bound, when I source it doesn’t seem to pick up the key bindings…
    – iaskakho
    Commented Jun 6, 2023 at 18:58
  • Your question contains many sub questions. How to setup LSP not using coc? How to setup TComment using lua? How to setup a tag generator using lua? May should you split the question in three or more. Commented Jun 6, 2023 at 19:55

3 Answers 3


Neovim is very Vim compatible.

Here is the steps for a standard migration:

  1. If you are used to use a plugin manager like vim-plug follow the instruction to install it on Neovim
  2. Copy ~/.vimrc into ~/.config/nvim/init.vim
  3. Copy the content of ~/vimfiles into ~/.config/nvim
  4. Copy the content of ~/vimfiles/plugged into /.config/nvim-data [optional]
  5. Start Neovim (some plugin configuration in your init.vim may trigger ignore them
  6. If you are using a plugin manager run the command to install the plugins (:PlugInstall for vim-plug)
  7. Restart Neovim
  8. If you are using coc run the following command: :CocInstall @yaegassy/coc-intelephense
  • This will just do the same thing I have vim using the neovim wrapper. Instead my goal is to use .lua config files and migrate my .vimrc to multiple.lua configs. I want to set it using the nvim way and using nvim api, I can’t seem to be able to achieve that.
    – iaskakho
    Commented Jun 6, 2023 at 18:53

Most of your Vim set-up will just work on Neovim if you follow the steps provided by Vivian, so whatever setup you already have to handle commenting, folds, and fussy finding should just work. You can port it to Lua one step at a time by following :h lua-guide.

I'll just address the PHP part, which seems to be the core of your question. First, if you use a feature-complete language server, you don't need to deal with tags at all.

The quickest minimal way to try LSP, assuming you have a server already installed, is to create the file ~/.config/nvim/after/ftplugin/php.lua with the following content:

  cmd = {"<language-server-executable-name>"}, -- Update this
  filetypes = {"php"}, 
  root_dir = function(pattern)
    local cwd = vim.loop.cwd()
    local root = util.root_pattern('composer.json', '.git')(pattern)
    return util.path.is_descendant(cwd, root) and cwd or root

This will start up the server when you create or read a PHP file, and by default completion should just work, as well as Ctrl-] to go to definition. Unless you have customized these, in that case you need to review your current settings.

To create more mappings, or any customization, you can use any of the LSP events, see :h lsp-events, or even just :h lsp to get all the details. You can also try the LspAttach function shown on lsp-config's README, it will work with and without that plug-in.

Of course, if you don't want to set up every LSP you need manually, installing lsp-config instead of defining every server per file type is the way to go


I've set up a basic config for Neovim. Here is my public repo with MIT-License.

Feel free to use anything if it helps you or contribute. It leads to web development with PHP, TailwindCSS etc.

  • 1
    Welcome to Vi and Vim SE and thank you for posting an answer. It is appreciated. Note that this site prefers self-contained answers as external links can break and become inaccessible. The way I understood it, OP was looking for general advice, not a specific config.
    – Friedrich
    Commented Jul 12, 2023 at 11:30
  • @Friedrich, hi :) thx for your hint.
    – Manny
    Commented Sep 24, 2023 at 7:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.