Neovim 101 — LSP

Let’s explore the different ways to configure LSP in Neovim.

7 min readOct 21, 2022


Neovim 101 — LSP

Neovim supports the Language Server Protocol (LSP). However, setting it up could be daunting for beginners.

In this article, we will start by configuring LSP using the built-in APIs without using any plugins. With this knowledge, we will check out plugins that make the configuration more straightforward and uncomplicated.

This article is part of the Neovim 101 series.

The Neovim configuration files are available in this repository.

Getting Started

Generally, there are 4 ways to configure LSP in Neovim, listed below from high to low in terms of the efforts.

  • Use the built-in LSP APIs
  • Use the nvim-lspconfig plugin that provides a collection of LSP configurations
  • Use plugins that wrap all the LSP boilerplates and configurations
  • Use a Neovim distribution that functions like an IDE

We will go through these options in this article.


Starting Neovim release 0.8, we have new APIs that make it easy to configure LSP without plugins.


vim.lsp.start (:h vim.lsp.start) creates a new LSP client and starts a language server or reuses an already running client if one is found matching the name and root_dir. It also attaches the current buffer to the client.

In the earlier version, we need to use vim.lsp.start_client and vim.lsp.buf_attach_client APIs. The new vim.lsp.start API makes it simpler.


To ensure a language server is only started for languages it can handle, we need to make sure to call vim.lsp.start()within a file type autocmd. There are 2 ways to achieve this.

  • Use an auto command (:h au)
  • Use a file type plugin…




Software engineer, Data Science and ML practitioner.