neovim-config/ctags.md

1.6 KiB

#Installing a Ctags-lsp I got the impression, that there is a level of interest for installing some autocompletion in neovim. So this is a guide centering on implementing a ctags lsp provider inside of neovim.

I use following config for lazy nvim: For installation config see lazy.md.

return {"neovim/nvim-lspconfig",
        dependencies = "netmute/ctags-lsp.nvim",
        config = function()
            vim.lsp.config("ctags-lsp", {
               filetypes = { "c,h,cc,cpp,hh,hpp" }, -- Or whatever language you want to use it for
            })
            vim.lsp.enable("ctags_lsp")
        end,
    };

The config function actually does not have to be called inside declaration block lets say. So if you have an old legacy vim configuration, which is not based on lua, then you could add "netmute/ctags-lsp.nvim" and "neovim/nvim-lspconfig" manually to your config. (For example if you use Vundle or Vim-plug.)

You can then add the following lua block to your config.

# Lua block

lua << EOF
-- Lua code here
vim.lsp.config("ctags-lsp", {
   filetypes = { "c,h,cc,cpp,hh,hpp" }, -- Or whatever language you want to use it for
})
vim.lsp.enable("ctags_lsp")
EOF

Installing the lsp binary

The lsp binary should be in your user path, but since it is manually installed you should not add it to your /usr/bin path. If $HOME/.local/bin is not in your path, I recommend you to add it to PATH. You can install the binary by running:

go install github.com/netmute/ctags-lsp@latest"

or by downloading the binary from the github page (see releases) and storing it in $HOME/.local/bin.

Installing