which-key.nvim icon indicating copy to clipboard operation
which-key.nvim copied to clipboard

Issue with cmdline-mode mappings that use <C-\>e on the RHS

Open b0o opened this issue 4 years ago • 0 comments

When triggering a cmdline-mode mapping created with WhichKey that uses <C-\>e on the RHS, I get the error E488: Trailing characters. Creating the same mapping with vim.api.nvim_set_keymap works just fine.

For reference, <C-\>e allows a mapping to manipulate the command line - see :h c_CTRL-\_e

-- This works
vim.api.nvim_set_keymap('c', '<C-k>', [[<C-\>e(" ".getcmdline())[:getcmdpos()-1][1:]<Cr>]], { noremap = true })

-- This doesn't work
require'which-key'.register({
    ['<C-k>'] = { [[<C-\>e(" ".getcmdline())[:getcmdpos()-1][1:]<Cr>]], "Kill to end of line" } 
}, { mode = 'c', noremap = true })

b0o avatar Nov 13 '21 02:11 b0o