Skip to content

Commit 7929a63

Browse files
authored
change: add replace_keycodes=false to expr mappings (#190)
neovim/neovim#19598 changed `vim.keymap.set` to replace keycodes by default for all mappings if `expr == true` instead of only luaref expr mappings. The toggle expr mappings are not luarefs but shouldn't have the keycodes replaced since they use `<Plug>`.
1 parent 5a71d73 commit 7929a63

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

doc/plugs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Following are the `<Plug>` mappings which you can use to quickly setup your cust
1818
Following snippets is same as the default mappings set by the plugin.
1919

2020
```lua
21-
local opt = { expr = true, remap = true }
21+
local opt = { expr = true, remap = true, replace_keycodes = false }
2222

2323
-- Toggle using count
2424
vim.keymap.set('n', 'gcc', "v:count == 0 ? '<Plug>(comment_toggle_current_linewise)' : '<Plug>(comment_toggle_linewise_count)'", opt)

lua/Comment/api.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,13 +248,13 @@ function api.setup(config)
248248
'n',
249249
cfg.toggler.line,
250250
"v:count == 0 ? '<Plug>(comment_toggle_current_linewise)' : '<Plug>(comment_toggle_linewise_count)'",
251-
{ expr = true, remap = true }
251+
{ expr = true, remap = true, replace_keycodes = false }
252252
)
253253
K(
254254
'n',
255255
cfg.toggler.block,
256256
"v:count == 0 ? '<Plug>(comment_toggle_current_blockwise)' : '<Plug>(comment_toggle_blockwise_count)'",
257-
{ expr = true, remap = true }
257+
{ expr = true, remap = true, replace_keycodes = false }
258258
)
259259

260260
K('n', cfg.opleader.line, '<Plug>(comment_toggle_linewise)')

0 commit comments

Comments
 (0)