A beginner guide on writing Neovim plugins in Lua.
In Part 1 of the article, I developed a very simple Neovim plugin. In this article let’s explore Neovim Lua's libraries and use them to enhance the plugin.
Let’s get started by setting up a proper plugin development environment.
:nvim_ followed tab and you should be able to see the Neovim built-in Lua APIs. However, navigating the help documentation is a bit cumbersome so let’s set up LSP.
If you install
:Telescope help_tags and you can easily search for the Neovim APIs that you need.
Lua Language Server — sumneko_lua
Set up Lua language server following the instructions here.
For this tutorial, I am going to use
luadev.nvim enables development setup for
init.lua and plugin development with full signature help, documentation, and completion for the Neovim Lua APIs.
I am using
packer.nvimto install the plugin.
:luafile % and
:PackerInstall to install the plugin, and use the configuration below to set up the plugin.