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 see <Space> mappings #135

Closed
jandamm opened this issue Jul 27, 2020 · 3 comments · Fixed by #240
Closed

Cannot see <Space> mappings #135

jandamm opened this issue Jul 27, 2020 · 3 comments · Fixed by #240

Comments

@jandamm
Copy link

jandamm commented Jul 27, 2020

Instructions: Replace the template text and remove irrelevant text (including this line)
Warning: if you don't fill this issue template and provide the reproducible steps the issue could be closed directly.

Environment (please complete the following information):

  • OS: macOS 10.15.6

  • (Neo)Vim version: nvim 0.4.3

  • Have you reproduced with a minimal vimrc: yes

Describe the bug
I cannot see a <Leader><Space> or <Leader><Leader> mapping.
I cannot use a <Leader><Tab> mapping.
All works just fine outside of vim-which-key but not when the window is opened.

To Reproduce
Steps to reproduce the behavior:

  1. Create the minimal vimrc min.vim:
set nocompatible
set runtimepath^=/path/to/vim-which-key
syntax on
filetype plugin indent on

let g:mapleader = "\<Space>"
nnoremap <silent> <leader>      :<c-u>WhichKey '<Space>'<CR>

nmap <Leader><Tab>    :bn<CR>
nmap <Leader><SPACE>  :bp<CR>
"nmap <Leader><Leader> :buffers<CR>
  1. Start (neo)vim with command: vim -u NONE min.vim -c 'so %'

  2. Type and wait for a second.
    Then try or again

  3. See error
    doesn't show up. shows up but isn't usable.

Expected behavior
I would expect both mappings to appear and work.

Screenshots
Screen Shot 2020-07-28 at 00 16 17

@jandamm
Copy link
Author

jandamm commented Jul 28, 2020

Got it working:

TAB

Seems to only work when a keymap is registered:

call which_key#register('<Space>', 'g:which_key_map')
let g:which_key_map =  {}

and it works.

Space

Must be set as a nmap and as registered

call which_key#register('<Space>', 'g:which_key_map')
nmap <silent> <Leader><SPACE> :bp<CR>
let g:which_key_map =  { ' ': ['bp', 'title' ]}

and it works.

@jandamm jandamm closed this as completed Jul 28, 2020
@jandamm
Copy link
Author

jandamm commented Jul 28, 2020

I would still consider (at least) the mapping as an issue.

@jandamm jandamm reopened this Jul 28, 2020
@sooriravindra
Copy link

Hit this issue today and the workaround was very helpful. Thank you @jandamm

mmrwoods added a commit to mmrwoods/vim-which-key that referenced this issue Aug 9, 2023
Update workaround for default <leader><leader> EasyMotion prefix to only
apply <leader><space> is actually mapped to an EasyMotion action, which
allows <leader><space> mapped to something other than EasyMotion actions
to automatically show up in the WhichKey menu.

Note: I use <leader><space> to toggle showing white space characters

Partial fix for liuchengxu#135 (does not fix <leader><tab>, only <leader><space>)
mmrwoods added a commit to mmrwoods/vim-which-key that referenced this issue Aug 9, 2023
Update workaround for default <leader><leader> EasyMotion prefix to only
apply when <leader><space> is actually mapped to an EasyMotion action.

This allows other <leader><space> mappings to automatically show up in
the WhichKey menu, without being explicitly added to the dictionary.

Note: I use <leader><space> to toggle showing white space characters

Partial fix for liuchengxu#135 (does not fix <leader><tab>, only <leader><space>)
liuchengxu pushed a commit that referenced this issue Aug 9, 2023
Update workaround for default <leader><leader> EasyMotion prefix to only
apply when <leader><space> is actually mapped to an EasyMotion action.

This allows other <leader><space> mappings to automatically show up in
the WhichKey menu, without being explicitly added to the dictionary.

Note: I use <leader><space> to toggle showing white space characters

Partial fix for #135 (does not fix <leader><tab>, only <leader><space>)
liuchengxu added a commit that referenced this issue Aug 10, 2023
The mapping `<Tab>` is tracked in the mappings in String form, while the
returned value from `getchar()` is a Number, convert it to String
manually so that the corresponding entry in `s:runtime` can be
retrieved.

Close #135
liuchengxu added a commit that referenced this issue Aug 13, 2023
* Convert "\<Tab>" to "<Tab>"

The mapping `<Tab>` is tracked in the mappings in String form, while the
returned value from `getchar()` is a Number, convert it to String
manually so that the corresponding entry in `s:runtime` can be
retrieved.

Close #135

* Handle more special keys properly

Part of #232, Thanks to @rene-descartes2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants