Neovim for Beginners — Remote Plugins

Make Neovim a better editor using remote plugins.



Neovim for Beginners — Remote Plugins

In a previous article, we use Python and Vimscript to develop text-to-speech and AWS S3 upload plugins. The plugins work for both Vim and Neovim as both support using Python for plugin development.

For Neovim, using the remote plugin (:h remote-plugin) feature, any programming language may be used to extend Neovim without changes to Neovim itself. Remote plugins are coprocesses that have a direct communication channel (via RPC) with the Neovim process.

Even though these plugins run in separate processes they can call, be called, and receive events just as if the plugin’s code were executed in the main process.

In this article, we are going to use pynvim which is a Neovim Python client to develop plugins. There are many great Python libraries that make it a perfect language to develop Neovim plugins.

This article is part of the Neovim for Beginners series.

The Neovim configuration files can be found in this repository.

Getting Started

The remote plugin feature supports the usage of any programming language in Neovim. You can check out the list of supported API clients for other programming languages (C, C++, Go, Rust, Node.js, etc)

Most likely pynvim has already been installed as part of Neovim installation. We can install the package using pip.

$ pip install pynvim

To check the installation status, use the :checkhealth command.

Neovim Health Check

With pynvim installed, we are ready to develop remote plugins now.

Plugin Testing

For plugin testing, we can use the plenary.nvim library.

plenary.nvim provides 3 different commands (PlenaryBustedFile, PlenaryBustedDirectory, PlenaryTestFile) for testing.

The test cases are run in a new Neovim instance so we do not need to clear the loaded package (package.loaded) every time.




Software engineer, Data Science and ML practitioner.