From d791379b52d07939ebd4fff63c0743d3dc8f7250 Mon Sep 17 00:00:00 2001 From: Aofei Sheng Date: Sun, 5 Nov 2023 17:17:28 +0800 Subject: [PATCH] feat(keymaps): add toggle for mouse --- lua/lazyvim/config/keymaps.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lua/lazyvim/config/keymaps.lua b/lua/lazyvim/config/keymaps.lua index c5f70016..168d02e6 100644 --- a/lua/lazyvim/config/keymaps.lua +++ b/lua/lazyvim/config/keymaps.lua @@ -123,6 +123,16 @@ if vim.lsp.inlay_hint then map("n", "uh", function() vim.lsp.inlay_hint(0, nil) end, { desc = "Toggle Inlay Hints" }) end map("n", "uT", function() if vim.b.ts_highlight then vim.treesitter.stop() else vim.treesitter.start() end end, { desc = "Toggle Treesitter Highlight" }) +local mouse = vim.o.mouse ~= "" and vim.o.mouse or "a" +map("n", "um", function() + if vim.o.mouse == "" then + vim.o.mouse = mouse + Util.info("Enabled mouse", { title = "Option" }) + else + vim.o.mouse = "" + Util.warn("Disabled mouse", { title = "Option" }) + end +end, { desc = "Toggle Mouse" }) -- lazygit map("n", "gg", function() Util.terminal({ "lazygit" }, { cwd = Util.root(), esc_esc = false, ctrl_hjkl = false }) end, { desc = "Lazygit (root dir)" })