Neovim is a powerful, modernized fork of Vim that is designed for developers who want a lightweight, yet extensible text editor. Its speed, versatility, and rich plugin ecosystem make it an excellent choice for Python development. In this blog post, we'll walk through the steps to set up Neovim for a seamless Python development experience.
First, we need to get the latest stable version of Neovim (currently 0.10.0). We can also install it using the system package manager (apt/yum/zypper) install neovim
or we can get it from GitHub.
mkdir -p ~/.local/bin/
cd ~/.local/bin
wget https://github.com/neovim/neovim/releases/download/v0.11.0/nvim-linux-x86_64.appimage
mv nvim.appimage nvim
chmod +x nvim
export PATH=$PATH:~/.local/bin # add ~/.local/bin to your PATH . Add this line to your ~/.bashrc
To add support for many of the Language Server Protocol (LSP) features, i.e., Formatting, Code action, goto documentation, we need a few packages that add this functionality. Programming languages that I use:
Language | Package | How to Install |
---|---|---|
C/C++ | clangd | (apt/yum/dnf/zypper) install clangd |
Lua | lua_ls | https://luals.github.io/#neovim-install |
Bash | bashls | https://github.com/bash-lsp/bash-language-server |
Vim Script | vimls | https://github.com/iamcco/vim-language-server |
Python | pylsp | pip install python-lsp-server[all] |
CMake | cmake | pip install cmake-language-server |
Latex | texlab | https://github.com/latex-lsp/texlab |
Text | textls | https://github.com/hangyav/textLSP |
``` bash
apt install clangd vim git cmake python3-venv luarocks tree-sitter-dev fd-find ripgrep gdb ninja-build
```
There are thousands of Neovim plugins available on GitHub. Only use the ones that you need. Here are the plugins that I use.
-
Clone the repo
cd ~/.config/ git clone https://github.com/srbhp/nvim.git
-
Install Plugins
Launch Neovim and run the following command to install the plugins:
:Lazy
-
Install
coq_nvim
dependencies: This needs thepython3-venv
package to be installed.:COQdeps
-
Check Neovim Health
:checkhealth
This will give you the current status of Neovim and report if there are any missing dependencies.
To set up a development environment using a devcontainer, follow these steps:
- Ensure you have Docker installed on your machine.
- Open the project in a container using Visual Studio Code.
- When prompted, select "Reopen in Container".
This will set up the development environment with all necessary dependencies and tools.