Member-only story

Neovim LSP Enhanced

alpha2phi

--

Additional features to enhance your LSP experience in Neovim.

Neovim — Enhanced LSP Experience

Overview

In the previous article, I walked through with you how to set up LSP and DAP in Neovim. In this article let’s enhance the LSP experience in Neovim by configuring and setting up additional features.

Installation of Language Servers

Just like the previous article, let’s get started by installing the language servers.

If you are using coc.nvim, normally the language server is installed automatically for you. For Neovim LSP, there are available plugins to automate this process. Here I will go through the manual installation steps.

Python

For Python, let’s install pyright.

$ npm install -g pyright

Golang

For Golang, let’s install gopls.

$ GO111MODULE=on go get golang.org/x/tools/gopls@latest

Rust

For Rust, let’s use rust_analyzer. The easiest way to install is to download the binary, copy it to a folder, and add the folder to the environment PATH.

Typescript

For Typescript, let’s install typescript-language-server.

$ npm install -g typescript-language-server

AutoCompletion

In the previous article, I use completion-nvim. For this article, I am going to use nvim-compe and add additional features.

In lua/plugins.lua, add the lines below to install the plugins.

use { 'neovim/nvim-lspconfig' }
use { 'hrsh7th/nvim-compe' }

Run :luafile % and :PackerInstall to install the plugins.

Create a lang folder under lua and add an init.lua file with the following content. This file sets up LSP for Python, Golang, Rust, and Typescript and also the key mappings.

--

--

Responses (1)