Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot map :WhichKey "<CR>" #118

Open
hk0i opened this issue May 18, 2020 · 2 comments
Open

Cannot map :WhichKey "<CR>" #118

hk0i opened this issue May 18, 2020 · 2 comments
Labels
enhancement New feature or request support

Comments

@hk0i
Copy link

hk0i commented May 18, 2020

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:

  1. Make some mappings with as leader (optional)
  2. :nnoremap :WhichKey "<CR>"<CR>
  3. Error shows

Expected behavior
Whichkey should function as it normally does in command mode

@lifeBalance
Copy link

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. ;-)

@rene-descartes2021
Copy link
Collaborator

rene-descartes2021 commented Dec 3, 2022

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.

@rene-descartes2021 rene-descartes2021 added enhancement New feature or request support labels Dec 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request support
Projects
None yet
Development

No branches or pull requests

3 participants