Tiny, tasty, and too useful to leave in your config. A small collection of Lua utilities and commands for Neovim — not big enough for their own plugin, but too handy to ignore.
This plugin bundles several lightweight but practical functions that improve everyday Neovim usage. Each function is self-contained, designed to be mapped to a keybinding, and focuses on quality-of-life enhancements — things that make editing faster, cleaner, or more delightful.
Your Neovim config can easily get cluttered with one-off helpers, commands, or scripts.
goodies.nvim is the middle ground — a comfy home for those neat ideas that don’t quite deserve their own repository.
M.comment_hr()Inserts a horizontal “commented” line that matches the file’s comment syntax and indentation. Great for visually separating sections in your code or notes.
-
M.code_runner()Detects the filetype and runs it using the appropriate command (e.g.python %,gcc %,node %, etc.). Prompts you to choose between multiple run modes (e.g.,default,debug,competitive). -
M.run_file(ht)Quick command to compile or execute the current file in a terminal split (horizontal or vertical). Example: runscargo runfor Rust,python %for Python, ormakefor C/C++.
-
M.open_url()Opens the URL under the cursor in your system’s default browser. Works with common formats likehttps://example.com. -
M.open_in_browser(url)Utility function to open a specific URL usingxdg-open,explorer,open, orwslview. -
M.open_at_regex_101()Detects and extracts regex patterns in supported languages and opens them in regex101.com prefilled for quick testing.
-
M.add_author_details()Inserts a standard comment header at the top of the file, including:- Author name
- GitHub
- Date (auto-generated)
Example:
require("goodies").add_author_details()
Produces:
-- Author: Rubin Bhandari <roobin.bhandari@gmail.com> -- Date: 2024-05-23 -- GitHub: https://github.com/rubiin -- Twitter: https://twitter.com/RubinCodes
-
M.word_count()Utility function to count the number of words in the current buffer or visual selection. -
M.auto_normal()Enable this somewhere in your config or add a keymap to activate it. Automatically exit insert mode after a period of inactivity. -
M.put_at_end(s)Enable this somewhere in your config or add a keymap to activate it. Insertssat end of current line without moving cursor. @param s string the string to append
Add something like this to your init.lua or keymaps.lua:
local goodies = require("goodies")
vim.keymap.set("n", "<leader>ch", goodies.comment_hr, { desc = "Insert comment HR" })
vim.keymap.set("n", "<leader>ru", goodies.code_runner, { desc = "Run current file" })
vim.keymap.set("n", "gx", goodies.open_url, { desc = "Open URL under cursor" })
vim.keymap.set("n", "<leader>yy",goodies.add_author_details, { desc = "Add author details" })
vim.keymap.set("n", "<leader>zz", function()
goodies.append_to_eol(",")
end, { desc = "Put , at end of line" })With lazy.nvim:
{
"rubiin/goodies.nvim",
opts = {
author = {
name = "John Doe",
email = "john.doe@example.com",
github = "johndoe",
twitter = "DoeTweets",
}
}
}If you use packer.nvim you can add the plugin with a use call. You may
choose to lazy-load it with cmd, ft, event, etc. Example:
use {
"rubiin/goodies.nvim",
-- lazy-load options (optional): cmd = {"SomeCommand"}, ft = {"lua"}, event = "BufReadPre"
event = "VeryLazy",
config = function()
require("goodies").setup({
author = {
name = "Your Name",
email = "your.email@example.com",
github = "yourusername",
twitter = "yourhandle",
},
auto_normal = { timeout = 3000 },
})
end,
}For vim-plug add the plugin in your init.vim and call the Lua setup from
your init.lua or an after/plugin file. Example:
Plug 'rubiin/goodies.nvim'Then in Lua (e.g. after/plugin/goodies.lua or init.lua):
require("goodies").setup({
author = {
name = "Your Name",
email = "your.email@example.com",
github = "yourusername",
twitter = "yourhandle",
},
auto_normal = { timeout = 3000 },
})c,cpp,cs,go,java,js,ts,py,rs,php,r,jl,rb,pl,html
Each filetype can have multiple run modes like default, debug, or competitive.
- All commands are written in pure Lua, no dependencies.
- Every function is safe to keymap directly.
- Designed to stay fast and clean — no global state, no side effects.
Rubin Bhandari
MIT © Rubin Bhandari