From db517f1bcf72f23bed88671c7a257d19fb14ae81 Mon Sep 17 00:00:00 2001 From: Yuan Chiu Date: Sat, 3 May 2025 11:47:50 +0800 Subject: [PATCH] feat nvim: add menu --- .../exact_plugins/exact_components/menu.lua | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 dot_config/nvim/exact_lua/exact_plugins/exact_components/menu.lua diff --git a/dot_config/nvim/exact_lua/exact_plugins/exact_components/menu.lua b/dot_config/nvim/exact_lua/exact_plugins/exact_components/menu.lua new file mode 100644 index 0000000..0ddb3da --- /dev/null +++ b/dot_config/nvim/exact_lua/exact_plugins/exact_components/menu.lua @@ -0,0 +1,28 @@ +return { + { "nvzone/volt" , lazy = true }, + { + "nvzone/menu", + dependencies = { "MunifTanjim/nui.nvim" }, + event = "VeryLazy", + config = function() + -- Keyboard users + vim.keymap.set("n", "", function() + require("menu").open("default") + end, {}) + + -- mouse users + nvimtree users! + vim.keymap.set({ "n", "v" }, "", function() + require('menu.utils').delete_old_menus() + + vim.cmd.exec '"normal! \\"' + + -- clicked buf + local buf = vim.api.nvim_win_get_buf(vim.fn.getmousepos().winid) + local options = vim.bo[buf].ft == "neo-tree" and "neo-tree" or "default" + + require("menu").open(options, { mouse = true }) + end, {}) + + end, + }, +}