Cannot map `:WhichKey "<CR>"`
hk0i opened this issue · 2 comments
Environment (please complete the following information):
- OS: Mac OS 10.15.4
- (Neo)Vim version: 0.4.3
- vim-which-key version: (not sure where to find version?)
- Have you reproduced with a minimal vimrc: no
Describe the bug
:WhichKey "<CR>"
works when typing it by hand, but mapping it to a key produces message:
E114: Missing quote ")
E116: Invalid arguments for function which_key#start
To Reproduce
Steps to reproduce the behavior:
- Make some mappings with as leader (optional)
:nnoremap :WhichKey "<CR>"<CR>
- Error shows
Expected behavior
Whichkey should function as it normally does in command mode
If you use vim-plug
, try to update the vim-which-key
plugin with :PlugUpdate
. I also had issues with the <cr>
key, but liuchengxu added support for that key. ;-)
I don't know the state of things when lifeBalance had things working.
Reproduced OP's report with:
let mapleader = "\<CR>"
let g:map = {}
let g:map.l = {'name':'+holiday', '1': ['echom ''merry xmas''', 'say greeting']}
call which_key#register('<CR>', 'g:map')
nnoremap <leader> :WhichKey '<CR>'<CR>
:WhichKey '<CR>'
works as reported in command mode, but in normal mode doesn't.
I suppose this may have to do with the use of <args>
in which_key#start()
. Replacing that with <q-args>
might help with this specific case, it might do some escape and un-escape magic.
Suggested workaround:
let F=function({->execute(':WhichKey "<CR>"','')})
nnoremap <leader> :call F()<CR>
Could probably make that a one-liner if you wanted.