A beginner guide on writing Neovim plugins in Lua.
There are many great Neovim plugins but not many guides on writing Neovim plugins in Lua. In this article, let’s start to explore developing Neovim plugins in Lua.
This is a beginner guide and we are going to learn by developing a simple plugin, and continue to explore more advanced topics in future articles.
- Part 1: This article.
- Part 2: Available here.
Table of Contents
- Startup Options
- Setting Runtimepath
- Use Custom Configuration File
- Setting up LSP (Optional)
- Plugin DIrectories Structure
- Hello World Plugin
- Define Plugin Command
- Publishing Plugin
- Installation and Testing
- Further Readings
Let’s first explore different methods to start Neovim without loading
vimrc files or plugins.
There are different ways that you can start Neovim without initialization.
nvim -u NONE: Start Neovim without loading
vimrcfiles and plugins
nvim -u NORC: Start Neovim without loading
vimrcfiles, but still load the plugins.
nvim --noplugin: Start Neovim, load
vimrcfiles but not the plugins.
nvim --clean: Equivalent to “
-u NONE -i NONE”. Skips initializations from files and environment variables. No ‘
shada’ file is read or written. Excludes user directories from ‘
To show you the default
runtimepath, I am going to use the
--clean option to start Neovim with a clean environment. Type "
:h --clean” to check out the documentation.
$ nvim --clean
:h rtp to check out the documentation for