Menu ui for neovim ( supports nested menus )
simplescreenrecorder-2024-10-05_19.06.12.mp4
{ "nvchad/volt" , lazy = true },
{ "nvchad/menu" , lazy = true },
require("menu").open(options, opts)
- options is a table or string, if string then it will look at the table from menus* module of this repo
- opts : { mouse = true, border = false }"
- Use
h
l
to move between windows - Use
q
to close the window - Press the keybind defined for menu item or scroll to it and press enter, to execute it
- Keyboard users can run the mapping when inside the menu, mouse users can click.
-- Keyboard users
vim.keymap.set("n", "<C-t>", function()
require("menu").open("default")
end, {})
-- mouse users + nvimtree users!
vim.keymap.set("n", "<RightMouse>", function()
vim.cmd.exec '"normal! \\<RightMouse>"'
local options = vim.bo.ft == "NvimTree" and "nvimtree" or "default"
require("menu").open(options, { mouse = true })
end, {})
Check example of defaults menu to see know syntax of options table.
I know a lot of you all would be infuriated by this plugin. here are some reasons for me to use it:
-
There are times when i'd want to perform some action but i dont want to set command/mapping for it, like one of those gitsigns commands, they're very useful and so many commands but i rarely use them. So a menu option with quick mouse click or menu opened from keybind would suffice!
-
I already got so many keybinds, I dont want to add more if I dont use it too frequently so I could use this menu!
-
I use my pc for more than 10 hours a day ( including, for the remote job I got ) and my keyboard usage is very high cuz of Vim so at times my fingers hurt and using mouse would tone it down.