Skip to content

Commit

Permalink
Automatically show <Space> mappings in menu (#239)
Browse files Browse the repository at this point in the history
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>)
  • Loading branch information
mmrwoods authored Aug 9, 2023
1 parent 004b1b8 commit ea87707
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions autoload/which_key/mappings.vim
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ function! which_key#mappings#parse(key, dict, visual) " {{{
let mapd.display = call(g:WhichKeyFormatFunc, [mapd.rhs])

let mapd.lhs = substitute(mapd.lhs, key, '', '')
" FIXME: <Plug>(easymotion-prefix)
if mapd.lhs ==? '<Space>'
" EasyMotion workaround, <leader><leader> is default easymotion prefix
if mapd.lhs ==? '<Space>' && mapcheck('<leader><space>', 'n') =~ 'easymotion'
continue
endif
let mapd.lhs = substitute(mapd.lhs, '<Space>', ' ', 'g')
Expand Down

0 comments on commit ea87707

Please sign in to comment.