From 1b1471d09e314f65cd60106d8643c8bd470e450a Mon Sep 17 00:00:00 2001 From: rto Date: Sun, 8 Mar 2026 21:28:43 +0100 Subject: [PATCH] Adding documentation for lazy and ctags-lsp --- ctags.md | 50 ++++++++++++++++++++++++++++++++++++++++++ lazy.md | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 117 insertions(+) create mode 100644 ctags.md create mode 100644 lazy.md diff --git a/ctags.md b/ctags.md new file mode 100644 index 0000000..0a17958 --- /dev/null +++ b/ctags.md @@ -0,0 +1,50 @@ +#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](lazy.md). +```lua +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. +```sh +# 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: +```sh +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 diff --git a/lazy.md b/lazy.md new file mode 100644 index 0000000..83eb1f9 --- /dev/null +++ b/lazy.md @@ -0,0 +1,67 @@ +# Installing lazy +Lazy is one of packet managers for neovim, which is implemented and configured +in lua. +This snippet installs lazy via git cloning it to stdpath data from the github +reposity. +The path data specifies the neovim directory inside the directory specified by +variable *XDG_DATA_HOME*, which defaults to `$HOME/.local/share`. + +I.e the default directory is $HOME/.local/share/nvim. +```lua +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +-- lazy.nvim installieren (falls nicht vorhanden) +if not (vim.uv or vim.loop).fs_stat(lazypath) then + local lazyrepo = "https://github.com/folke/lazy.nvim.git" + local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end +end +-- Add lazy.nvim directory to the path lua path. +vim.opt.rtp:prepend(lazypath) +``` + + +## Sourcing plugins +When adding following line: +```lua +require("lazy").setup("plugins") +``` + +Lazy will source all lua files found in the source directory plugins. + +The neovim config folder is: `$XDG_CONFIG_HOME`/nvim/, where *XDG_CONFIG_HOME* +defaults to `$HOME/.config/`. +I.e. the resulting directory which should exist is: +`$HOME/.config/nvim/lua/plugins`. + +For simplicity each file in the directory should contain only one plugin. + +## Adding plugins +Adding plugins is simple. Usually there is a example on the github page. +But with this approach you need to add a `return` in front of the object +and store the the into a new file. +For example: +```lua +return { + "NeogitOrg/neogit", + dependencies = { + "nvim-lua/plenary.nvim", -- required + "sindrets/diffview.nvim", -- optional - Diff integration + + -- Only one of these is needed. + "nvim-telescope/telescope.nvim", -- optional + "ibhagwan/fzf-lua", -- optional + "echasnovski/mini.pick", -- optional + }, + }; +``` +This will return the shown object. + +For further explanation and documentation consult the documentation of lazy.