Writing Neovim Plugins — A Beginner Guide (Part 1)

alpha2phi
6 min readMay 22, 2021

A beginner guide on writing Neovim plugins in Lua.

Writing Neovim Plugins

Overview

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

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 vimrc files and plugins
  • nvim -u NORC: Start Neovim without loading vimrc files, but still load the plugins.
  • nvim --noplugin: Start Neovim, load vimrc files 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 ‘runtimepath’.

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

Runtimepath

Type :h rtp to check out the documentation for runtimepath.

--

--

alpha2phi

Software engineer, Data Science and ML practitioner.