/neovim

My neovim configs

Primary LanguageLua

Jon Zeolla custom neovim configs

This is meant to be cloned into ~/.config/nvim/lua/custom/ to layer on top of NvChad. Some notable details:

  • custom/init.lua is for general settings and configs done in the buffer or global contexts.
  • custom/plugins/PLUGIN_NAME.lua is setup specifics for a specific plugin.

Language servers

This is the most common use case; adding a language server or configuring one. To see language server info, run :LspInfo.

To see information about installed LSPs (and DAP servers, linters, and formatters), run :Mason.

Adding a language server

Make sure that your language server is being installed by mason.lua, and that it's also being configured/loaded by lspconfig.lua.

Configuring a language server

If you need a custom configuration for the language server, go to lspconfig.lua, add the language server to the customized local variable, and then create a corresponding language_servers/<name>.lua file with the configuration. See that folder for examples.

A note about ALE

If you're having a hard time figuring out which language server is creating a diagnostic message, it's probably one of the ALE linters.

Run :ALEInfo, look into the enabled linters and tweak their configurations as needed.

Plugins

To see information about installed plugins, run :Mason and :Lazy.

Adding a Plugin

Add the new plugin to the mason.lua to ensure it gets properly installed and updated over time.

Configuring a Plugin

To configure a plugin, edit plugins.lua to add a new local, and add it to the plugins local. Then you can create a new file under plugins with a matching name and a configuration similar to:

local plugin = {
    "thething/here",
    dependencies = {"anyoptional/dependencies"},
    opts = {
        optional = { opts = "here" },
    }
    config = function()
      require("thething").setup({
          configuration = {
              enabled = true,
          }
          })
    end
}

return plugin

Keep in mind that dependencies, and opts are entirely optional (more on opts in the docs below) and just examples. config should probably exist, but a minimal version would look more like:

config = function()
  require("thing").setup()
end

When configuring a plugin, check out the other plugins here and refer to the docs of the plugin you're setting up.

opts vs config

In plugins/ if we specify an opts then it will run require("PLUGIN_NAME_HERE").setup(opts) without needing to explicitly configure it to do so.

config is useful when you're running setup() for a plugin manually. If you set both config and opts, the opts table becomes the second argument to the setup() function.

Other notes

To check what LSPs are setup/attached, use :LspInfo.

cmp plugins are completion-related, whereas lsp are the language servers.