From 6318edadc32acce3ed41a6995a5faa5395b5f562 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sat, 8 Jul 2023 15:28:13 +0200 Subject: [PATCH] fix(defaults): visual hash (#) on text with "?" Problem: The default "#" mapping fails on the following example after v$h# with cursor at start of the first line: aa?/\bb aa aa?/\bb Solution: Also escape "?". --- runtime/lua/vim/_editor.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/lua/vim/_editor.lua b/runtime/lua/vim/_editor.lua index 80e7518b01..0bbbed74bb 100644 --- a/runtime/lua/vim/_editor.lua +++ b/runtime/lua/vim/_editor.lua @@ -1029,7 +1029,7 @@ function vim._init_default_mappings() local esc_chunks = vim .iter(chunks) :map(function(v) - return vim.fn.escape(v, [[/\]]) + return vim.fn.escape(v, [[?/\]]) end) :totable() local esc_pat = table.concat(esc_chunks, [[\n]])