Neovim Plugins and Configuration Recipes | 3

alpha2phi
6 min readOct 2, 2023

Series to explore Neovim plugins and configuration recipes.

Neovim Plugins and Configuration Recipes | 3

This article is part of the Neovim Plugins and Configuration Recipes series.

The Neovim configuration files are available in this repository.

Getting Started

In this article, we continue to explore Neovim plugins and configuration recipes to improve our development workflow.

Plugins

conform.nvim

conform.nvim is a lightweight yet powerful formatter plugin for Neovim. It is a good alternative to null-ls.nvim in terms of formatting.

It provides the following features:

  • Preserves extmarks and folds — Most formatters replace the entire buffer, which clobbers extmarks and folds and can cause the viewport and cursor to jump unexpectedly. Conform calculates minimal diffs and applies them using the built-in LSP format utilities.
  • Fixes bad-behaving LSP formatters — Some LSP servers are lazy and simply replace the entire buffer, leading to the problems mentioned above. Conform hooks into the LSP handler and turn these responses into proper piecewise changes.
  • Enables range formatting for all formatters — Since conform calculates minimal diffs, it can perform range formatting even if the underlying formatter doesn’t support it.
  • Simple API — Conform exposes a simple, imperative API modeled after vim.lsp.buf.format().

To install it using lazy.nvim,

{
"stevearc/conform.nvim",
event = "BufReadPre",
opts = {},
},

One particularly useful feature is the APIs to list and use the formatters. For example, we can list the formatters in the status line.

conform.nvim + nvim-lint is a good alternative to null-ls.nvim.

none-ls.nvim

none-ls.nvim is a community fork of null-ls.nvim. For those who would like to maintain their existing configurations without many changes, this is the new plugin to use. The only change required is the repository name.

trailblazer.nvim

--

--

alpha2phi

Software engineer, Data Science and ML practitioner.