Skip to main content

LSP / DAP / formatters

LSP servers

BashDockerCC++EslintJsonLuaPhpPythonRustTailwindCSSJavascriptTypescriptAngularVue.jsReactSvelteAstroYaml

These LSPs, formatters, linters, and debug adapters are automatically installed and enabled. All of them are managed by Mason.

There are two ways to add a new LSP:

1. Install it manually using Mason
This is useful for quick testing, but the change will not be persistent if you move the configuration to another machine.

2. Register it in the configuration (recommended)
Create a Lua file with the name of the server inside:

E.g. lua/okivim/lsp/servers/clangd.lua

and add the configuration as described in the official documentation.

return function(capabilities)
vim.lsp.config("clangd", {
capabilities = capabilities,
cmd = {
"clangd",
"--background-index",
"--clang-tidy",
"--completion-style=detailed",
"--header-insertion=iwyu",
},
})
end
info

The configuration is designed so that LSPs are automatically detected and added to the auto-install list based on the server file name; therefore, the file name must match the LSP server name.

A full list of available LSP servers can be found here:
https://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.md

By doing this, the LSP will be registered in the list of servers that are automatically installed and configured, making the setup fully reproducible across machines.

Debug adapters (DAP)

  • debugpy (Python)
  • codelldb (Rust / C / C++)
  • js-debug-adapter (JS / TS)
  • php-debug-adapter (PHP)
info

The Debug Adapter Protocol (DAP) configurations are defined in lua/okivim/plugins/dap.lua. To use a DAP adapter, uncomment its corresponding block and install it with :MasonInstall <adapter-name> before running the debugger.

Formatters

Okivim does not automatically install formatters for you.

The formatters defined by default in conform.lua are only related to the LSP servers that are supported by default in this distribution.

They are included for convenience and consistency with the supported languages, but they are not automatically installed.

You are still responsible for installing the formatter binary yourself.

  • Install the formatter you want (via Mason if available, or manually).
  • If the formatter is already listed in formatters_by_ft, it will start working automatically.
  • If it is not listed, simply add it to the formatters_by_ft table in conform.lua.

If the formatter binary exists in your system, Conform will use it.

If it does not exist, Conform will fall back to LSP formatting (because lsp_fallback = true is enabled).


Installing a Formatter

You can install formatters in two ways:

1. Using Mason (if available)

:Mason

Search for the formatter and install it.

2. Installing Manually

Some formatters belong to the language ecosystem and should be installed manually.

Examples:

Python

pipx install black

Rust

rustup component add rustfmt

Node-based tools (Prettier, Prettierd, Stylelint)

Make sure you have:

  • node
  • npm

Then install globally or via Mason.


Adding a New Formatter

To add a formatter for a new language:

formatters_by_ft = {
...
java = { "google-java-format" },
}

Make sure:

  • The filetype matches Neovim's filetype name.
  • The formatter binary exists in your system.

To check the filetype of the current buffer:

:set filetype?


Summary

  • Okivim configures formatters but does not manage toolchains.
  • Default formatters match the LSPs supported by this distribution.
  • Install the formatter you want.
  • If it is listed, it works automatically.
  • If not, add it to formatters_by_ft.
  • Use :ConformInfo to verify the active formatter.
info

Formatter configurations are defined in lua/okivim/plugins/conform.lua. To check the active formatter for the current buffer: :ConformInfo