From fa94c733625d78722f3780884bc020ea61b4ab1b Mon Sep 17 00:00:00 2001 From: akioweh <0@akioweh.com> Date: Mon, 28 Jul 2025 23:59:47 +0400 Subject: [PATCH] fix printable characters being mapped in select mode most of the "visual mode" mappings use "v" instead of "x", affecting select mode, which should not have printable characters remapped. (this is felt when e.g. using snippets) --- lua/lazyvim/config/keymaps.lua | 6 +++--- lua/lazyvim/plugins/editor.lua | 6 +++--- lua/lazyvim/plugins/extras/ai/copilot-chat.lua | 10 +++++----- lua/lazyvim/plugins/extras/coding/mini-surround.lua | 2 +- lua/lazyvim/plugins/extras/dap/core.lua | 2 +- lua/lazyvim/plugins/extras/editor/dial.lua | 4 ++-- lua/lazyvim/plugins/extras/editor/fzf.lua | 4 ++-- lua/lazyvim/plugins/extras/editor/telescope.lua | 4 ++-- lua/lazyvim/plugins/extras/lang/clojure.lua | 4 ++-- lua/lazyvim/plugins/extras/lang/java.lua | 2 +- lua/lazyvim/plugins/extras/lang/r.lua | 4 ++-- lua/lazyvim/plugins/formatting.lua | 2 +- lua/lazyvim/plugins/lsp/keymaps.lua | 4 ++-- 13 files changed, 27 insertions(+), 27 deletions(-) diff --git a/lua/lazyvim/config/keymaps.lua b/lua/lazyvim/config/keymaps.lua index fbc7f5d1..de594b62 100644 --- a/lua/lazyvim/config/keymaps.lua +++ b/lua/lazyvim/config/keymaps.lua @@ -81,8 +81,8 @@ map({ "i", "x", "n", "s" }, "", "w", { desc = "Save File" }) map("n", "K", "norm! K", { desc = "Keywordprg" }) -- better indenting -map("v", "<", "", ">gv") +map("x", "<", "", ">gv") -- commenting map("n", "gco", "oVcxnormal gccfxa", { desc = "Add Comment Below" }) @@ -114,7 +114,7 @@ map("n", "[q", vim.cmd.cprev, { desc = "Previous Quickfix" }) map("n", "]q", vim.cmd.cnext, { desc = "Next Quickfix" }) -- formatting -map({ "n", "v" }, "cf", function() +map({ "n", "x" }, "cf", function() LazyVim.format({ force = true }) end, { desc = "Format" }) diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index 4aaf3d1f..1dd7919b 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -18,7 +18,7 @@ return { }, }) end, - mode = { "n", "v" }, + mode = { "n", "x" }, desc = "Search and Replace", }, }, @@ -163,8 +163,8 @@ return { end, "Prev Hunk") map("n", "]H", function() gs.nav_hunk("last") end, "Last Hunk") map("n", "[H", function() gs.nav_hunk("first") end, "First Hunk") - map({ "n", "v" }, "ghs", ":Gitsigns stage_hunk", "Stage Hunk") - map({ "n", "v" }, "ghr", ":Gitsigns reset_hunk", "Reset Hunk") + map({ "n", "x" }, "ghs", ":Gitsigns stage_hunk", "Stage Hunk") + map({ "n", "x" }, "ghr", ":Gitsigns reset_hunk", "Reset Hunk") map("n", "ghS", gs.stage_buffer, "Stage Buffer") map("n", "ghu", gs.undo_stage_hunk, "Undo Stage Hunk") map("n", "ghR", gs.reset_buffer, "Reset Buffer") diff --git a/lua/lazyvim/plugins/extras/ai/copilot-chat.lua b/lua/lazyvim/plugins/extras/ai/copilot-chat.lua index 58169b1e..fd4b84f1 100644 --- a/lua/lazyvim/plugins/extras/ai/copilot-chat.lua +++ b/lua/lazyvim/plugins/extras/ai/copilot-chat.lua @@ -17,14 +17,14 @@ return { end, keys = { { "", "", ft = "copilot-chat", desc = "Submit Prompt", remap = true }, - { "a", "", desc = "+ai", mode = { "n", "v" } }, + { "a", "", desc = "+ai", mode = { "n", "x" } }, { "aa", function() return require("CopilotChat").toggle() end, desc = "Toggle (CopilotChat)", - mode = { "n", "v" }, + mode = { "n", "x" }, }, { "ax", @@ -32,7 +32,7 @@ return { return require("CopilotChat").reset() end, desc = "Clear (CopilotChat)", - mode = { "n", "v" }, + mode = { "n", "x" }, }, { "aq", @@ -46,7 +46,7 @@ return { end) end, desc = "Quick Chat (CopilotChat)", - mode = { "n", "v" }, + mode = { "n", "x" }, }, { "ap", @@ -54,7 +54,7 @@ return { require("CopilotChat").select_prompt() end, desc = "Prompt Actions (CopilotChat)", - mode = { "n", "v" }, + mode = { "n", "x" }, }, }, config = function(_, opts) diff --git a/lua/lazyvim/plugins/extras/coding/mini-surround.lua b/lua/lazyvim/plugins/extras/coding/mini-surround.lua index d8ff25c5..05fed28e 100644 --- a/lua/lazyvim/plugins/extras/coding/mini-surround.lua +++ b/lua/lazyvim/plugins/extras/coding/mini-surround.lua @@ -8,7 +8,7 @@ return { -- Populate the keys based on the user's options local opts = LazyVim.opts("mini.surround") local mappings = { - { opts.mappings.add, desc = "Add Surrounding", mode = { "n", "v" } }, + { opts.mappings.add, desc = "Add Surrounding", mode = { "n", "x" } }, { opts.mappings.delete, desc = "Delete Surrounding" }, { opts.mappings.find, desc = "Find Right Surrounding" }, { opts.mappings.find_left, desc = "Find Left Surrounding" }, diff --git a/lua/lazyvim/plugins/extras/dap/core.lua b/lua/lazyvim/plugins/extras/dap/core.lua index d84b71bf..aaabce8d 100644 --- a/lua/lazyvim/plugins/extras/dap/core.lua +++ b/lua/lazyvim/plugins/extras/dap/core.lua @@ -84,7 +84,7 @@ return { -- stylua: ignore keys = { { "du", function() require("dapui").toggle({ }) end, desc = "Dap UI" }, - { "de", function() require("dapui").eval() end, desc = "Eval", mode = {"n", "v"} }, + { "de", function() require("dapui").eval() end, desc = "Eval", mode = {"n", "x"} }, }, opts = {}, config = function(_, opts) diff --git a/lua/lazyvim/plugins/extras/editor/dial.lua b/lua/lazyvim/plugins/extras/editor/dial.lua index 602b747c..7a9a76ae 100644 --- a/lua/lazyvim/plugins/extras/editor/dial.lua +++ b/lua/lazyvim/plugins/extras/editor/dial.lua @@ -19,8 +19,8 @@ return { keys = { { "", function() return M.dial(true) end, expr = true, desc = "Increment", mode = {"n", "v"} }, { "", function() return M.dial(false) end, expr = true, desc = "Decrement", mode = {"n", "v"} }, - { "g", function() return M.dial(true, true) end, expr = true, desc = "Increment", mode = {"n", "v"} }, - { "g", function() return M.dial(false, true) end, expr = true, desc = "Decrement", mode = {"n", "v"} }, + { "g", function() return M.dial(true, true) end, expr = true, desc = "Increment", mode = {"n", "x"} }, + { "g", function() return M.dial(false, true) end, expr = true, desc = "Decrement", mode = {"n", "x"} }, }, opts = function() local augend = require("dial.augend") diff --git a/lua/lazyvim/plugins/extras/editor/fzf.lua b/lua/lazyvim/plugins/extras/editor/fzf.lua index e9177457..65121060 100644 --- a/lua/lazyvim/plugins/extras/editor/fzf.lua +++ b/lua/lazyvim/plugins/extras/editor/fzf.lua @@ -248,8 +248,8 @@ return { { "sq", "FzfLua quickfix", desc = "Quickfix List" }, { "sw", LazyVim.pick("grep_cword"), desc = "Word (Root Dir)" }, { "sW", LazyVim.pick("grep_cword", { root = false }), desc = "Word (cwd)" }, - { "sw", LazyVim.pick("grep_visual"), mode = "v", desc = "Selection (Root Dir)" }, - { "sW", LazyVim.pick("grep_visual", { root = false }), mode = "v", desc = "Selection (cwd)" }, + { "sw", LazyVim.pick("grep_visual"), mode = "x", desc = "Selection (Root Dir)" }, + { "sW", LazyVim.pick("grep_visual", { root = false }), mode = "x", desc = "Selection (cwd)" }, { "uC", LazyVim.pick("colorschemes"), desc = "Colorscheme with Preview" }, { "ss", diff --git a/lua/lazyvim/plugins/extras/editor/telescope.lua b/lua/lazyvim/plugins/extras/editor/telescope.lua index 9fdf7e13..60ebdf7f 100644 --- a/lua/lazyvim/plugins/extras/editor/telescope.lua +++ b/lua/lazyvim/plugins/extras/editor/telescope.lua @@ -132,8 +132,8 @@ return { { "sq", "Telescope quickfix", desc = "Quickfix List" }, { "sw", LazyVim.pick("grep_string", { word_match = "-w" }), desc = "Word (Root Dir)" }, { "sW", LazyVim.pick("grep_string", { root = false, word_match = "-w" }), desc = "Word (cwd)" }, - { "sw", LazyVim.pick("grep_string"), mode = "v", desc = "Selection (Root Dir)" }, - { "sW", LazyVim.pick("grep_string", { root = false }), mode = "v", desc = "Selection (cwd)" }, + { "sw", LazyVim.pick("grep_string"), mode = "x", desc = "Selection (Root Dir)" }, + { "sW", LazyVim.pick("grep_string", { root = false }), mode = "x", desc = "Selection (cwd)" }, { "uC", LazyVim.pick("colorscheme", { enable_preview = true }), desc = "Colorscheme with Preview" }, { "ss", diff --git a/lua/lazyvim/plugins/extras/lang/clojure.lua b/lua/lazyvim/plugins/extras/lang/clojure.lua index 7197aabd..d1745a46 100644 --- a/lua/lazyvim/plugins/extras/lang/clojure.lua +++ b/lua/lazyvim/plugins/extras/lang/clojure.lua @@ -76,13 +76,13 @@ return { end vim.keymap.set( - { "n", "v" }, + { "n", "x" }, "[c", "call search('^; -\\+$', 'bw')", { silent = true, buffer = true, desc = "Jumps to the begining of previous evaluation output." } ) vim.keymap.set( - { "n", "v" }, + { "n", "x" }, "]c", "call search('^; -\\+$', 'w')", { silent = true, buffer = true, desc = "Jumps to the begining of next evaluation output." } diff --git a/lua/lazyvim/plugins/extras/lang/java.lua b/lua/lazyvim/plugins/extras/lang/java.lua index 8098b6b3..04db6ed1 100644 --- a/lua/lazyvim/plugins/extras/lang/java.lua +++ b/lua/lazyvim/plugins/extras/lang/java.lua @@ -221,7 +221,7 @@ return { }) wk.add({ { - mode = "v", + mode = "x", buffer = args.buf, { "cx", group = "extract" }, { diff --git a/lua/lazyvim/plugins/extras/lang/r.lua b/lua/lazyvim/plugins/extras/lang/r.lua index 6320f624..aa6a3df1 100644 --- a/lua/lazyvim/plugins/extras/lang/r.lua +++ b/lua/lazyvim/plugins/extras/lang/r.lua @@ -17,12 +17,12 @@ return { -- of files supported by R.nvim. This is an -- opportunity to create mappings local to buffers. vim.keymap.set("n", "", "RDSendLine", { buffer = true }) - vim.keymap.set("v", "", "RSendSelection", { buffer = true }) + vim.keymap.set("x", "", "RSendSelection", { buffer = true }) local wk = require("which-key") wk.add({ buffer = true, - mode = { "n", "v" }, + mode = { "n", "x" }, { "a", group = "all" }, { "b", group = "between marks" }, { "c", group = "chunks" }, diff --git a/lua/lazyvim/plugins/formatting.lua b/lua/lazyvim/plugins/formatting.lua index ae32c0ef..9aee291e 100644 --- a/lua/lazyvim/plugins/formatting.lua +++ b/lua/lazyvim/plugins/formatting.lua @@ -29,7 +29,7 @@ return { function() require("conform").format({ formatters = { "injected" }, timeout_ms = 3000 }) end, - mode = { "n", "v" }, + mode = { "n", "x" }, desc = "Format Injected Langs", }, }, diff --git a/lua/lazyvim/plugins/lsp/keymaps.lua b/lua/lazyvim/plugins/lsp/keymaps.lua index 318ec911..b05eeed6 100644 --- a/lua/lazyvim/plugins/lsp/keymaps.lua +++ b/lua/lazyvim/plugins/lsp/keymaps.lua @@ -22,8 +22,8 @@ function M.get() { "K", function() return vim.lsp.buf.hover() end, desc = "Hover" }, { "gK", function() return vim.lsp.buf.signature_help() end, desc = "Signature Help", has = "signatureHelp" }, { "", function() return vim.lsp.buf.signature_help() end, mode = "i", desc = "Signature Help", has = "signatureHelp" }, - { "ca", vim.lsp.buf.code_action, desc = "Code Action", mode = { "n", "v" }, has = "codeAction" }, - { "cc", vim.lsp.codelens.run, desc = "Run Codelens", mode = { "n", "v" }, has = "codeLens" }, + { "ca", vim.lsp.buf.code_action, desc = "Code Action", mode = { "n", "x" }, has = "codeAction" }, + { "cc", vim.lsp.codelens.run, desc = "Run Codelens", mode = { "n", "x" }, has = "codeLens" }, { "cC", vim.lsp.codelens.refresh, desc = "Refresh & Display Codelens", mode = { "n" }, has = "codeLens" }, { "cR", function() Snacks.rename.rename_file() end, desc = "Rename File", mode ={"n"}, has = { "workspace/didRenameFiles", "workspace/willRenameFiles" } }, { "cr", vim.lsp.buf.rename, desc = "Rename", has = "rename" },