Skip to content

Commit

Permalink
fix: some symbols can't be mapped correctly (#2081)
Browse files Browse the repository at this point in the history
* fix: support , . / symbol binding

* test: add keymap test
  • Loading branch information
OnlyWick authored Nov 30, 2024
1 parent ed31156 commit ca4d333
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lua/cmp/utils/keymap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 <C-J> from <NL>, etc.
return vim.api.nvim_eval(string.format([["\<*%s>"]], match))
end)
Expand Down
2 changes: 2 additions & 0 deletions lua/cmp/utils/keymap_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ describe('keymap', function()
'<C-;>',
'<C-,>',
'<C-:>',
'<C-.>',
'<C-/>',
'<C-_>',
"<C-'>",
'<Tab>',
Expand Down

0 comments on commit ca4d333

Please sign in to comment.