Faster Neovim Plugin Development with plenary.nvim

Use plenary.nvim to help you develop plugins faster.

alpha2phi
4 min readOct 30, 2021
Develop Plugin using plenary.nvim

Overview

In this article, let’s walk through plenary.nvimwhich is a Neovim Lua library that provides essential Lua functions we need to develop Neovim plugins.

Popup

A popup menu can be easily created using the library.

Default Popup

local popup = require "plenary.popup"local function create_default_popup()
local win_id = popup.create({ "menu item 1", "menu item 2", "menu item 3" }, {})
print(win_id)
end
create_default_popup()

Custom Popup

I can also specify the line, column, minimum width, border, and highlight.

vim.cmd [[highlight PopupColor ctermbg=black ctermfg=blue guifg=blue guibg=green]]local function create_highlight_popup()
local win_id = popup.create({ "item 1", "item 2", "item 3" }, {
line = 15,
col = 45,
minwidth = 20,
border = true,
highlight = "PopupColor",
})

print(win_id)
end
create_highlight_popup()

Custom Border Popup

--

--

alpha2phi

Software engineer, Data Science and ML practitioner.