Skip to content

Instantly share code, notes, and snippets.

@metalelf0
Created July 8, 2026 19:35
Show Gist options
  • Select an option

  • Save metalelf0/cfcd873473987533a341b4f59edcc0fe to your computer and use it in GitHub Desktop.

Select an option

Save metalelf0/cfcd873473987533a341b4f59edcc0fe to your computer and use it in GitHub Desktop.
A simple nvim menu with custom commands using vim.ui.select
local M = {}
local core = require("lib/core")
M.commands = {}
M.commands.EditNeovimConfig = {
command = ":e " .. core.get_configdir() .. "/init.lua",
description = "πŸŒ‘ Edit neovim config",
}
M.commands.EditBatConfig = { command = ":e ~/.config/bat/config", description = "πŸ¦‡ Edit bat config" }
M.commands.EditInbox = { command = ":e ~/iCloud-Obsidian/work/inbox.md", description = "πŸ“₯ Inbox" }
M.commands.EditKittyConfig = { command = ":e ~/.config/kitty/kitty.conf", description = "🐱 Edit kitty config" }
M.commands.EditTmuxConfig = { command = ":e ~/.config/tmux/tmux.conf", description = "🍱 Edit tmux config" }
M.commands.EditLazygitConfig =
{ command = ":e ~/Library/Application Support/lazygit/config.yml", description = "πŸ”± Edit lazygit config" }
M.commands.EditWeztermConfig =
{ command = ":e ~/.config/wezterm/wezterm.lua", description = "πŸ”§ Edit Wezterm config" }
M.commands.EditGhosttyConfig = { command = ":e ~/.config/ghostty/config", description = "πŸ‘» Edit Ghostty config" }
M.commands.SourceCurrentLuaFile = { command = ":luafile %", description = "πŸ„ Lua: source current file" }
M.commands.EditLspLog =
{ command = ":e " .. core.get_homedir() .. "/.local/state/nvim/lsp.log", description = "🧰 Edit LSP Log" }
M.commands.EmptyLspLog =
{ command = "!echo > " .. core.get_homedir() .. "/.local/state/nvim/lsp.log", description = "◻️ Empty LSP Log" }
M.run = function()
vim.ui.select(vim.tbl_keys(M.commands), {
prompt = "Whattya wanna do?",
format_item = function(item)
return M.commands[item].description
end,
}, function(choice)
local chosen_command = M.commands[choice]
vim.cmd(chosen_command.command)
end)
end
return M
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment