From b165dcbf7afef2d10c26a8f9b16fdf5dbc3e640c Mon Sep 17 00:00:00 2001 From: Wick Date: Mon, 4 Nov 2024 19:53:51 +0800 Subject: [PATCH 1/2] fix: support , . / symbol binding --- lua/cmp/utils/keymap.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/cmp/utils/keymap.lua b/lua/cmp/utils/keymap.lua index 0fb8692e4..ea3520645 100644 --- a/lua/cmp/utils/keymap.lua +++ b/lua/cmp/utils/keymap.lua @@ -8,7 +8,7 @@ local keymap = {} ---@param keys string ---@return string keymap.t = function(keys) - return (string.gsub(keys, '(<[A-Za-z0-9\\%-%[%]%^@;_]->)', function(match) + return (string.gsub(keys, '(<[A-Za-z0-9\\%-%[%]%^@;_,%./]->)', function(match) return vim.api.nvim_eval(string.format([["\%s"]], match)) end)) end @@ -17,7 +17,7 @@ end ---@param keys string ---@return string keymap.normalize = vim.fn.has('nvim-0.8') == 1 and function(keys) - local t = string.gsub(keys, '<([A-Za-z0-9\\%-%[%]%^@;_]-)>', function(match) + local t = string.gsub(keys, '<([A-Za-z0-9\\%-%[%]%^@;_,%./]-)>', function(match) -- Use the \<* notation, which distinguishes from , etc. return vim.api.nvim_eval(string.format([["\<*%s>"]], match)) end) From c934ec34469606b4cbb8a5c0f18843aca37d6a7b Mon Sep 17 00:00:00 2001 From: Wick Date: Wed, 20 Nov 2024 15:12:17 +0800 Subject: [PATCH 2/2] test: add keymap test --- lua/cmp/utils/keymap_spec.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/cmp/utils/keymap_spec.lua b/lua/cmp/utils/keymap_spec.lua index 108b745f7..128c61b9e 100644 --- a/lua/cmp/utils/keymap_spec.lua +++ b/lua/cmp/utils/keymap_spec.lua @@ -19,6 +19,8 @@ describe('keymap', function() '', '', '', + '', + '', '', '', '',