Open Kingsy opened 3 years ago
Sorry, but this is the first time I heard about which-key, and I don't quite understand this issue. Could you please describe it in more detail?
Slimv has the g:slimv_keybindings
option, values 1 and 2 define two built-in mappings, any other value means no mapping is defined by slimv, so you can create your own.
Unfortunately there is no similar option for paredit at the moment.
which-key is a leader guide that allows the creating of a menu system for the leader and local leader key bindings https://github.com/liuchengxu/vim-which-key
It allows creating a map as so, which gives the ability to hide groups of functionality behind a single binding. Then use a further level of bindings after the initial is pressed. l in this case is "lsp" which as you can imagine contains alot of keybindings, but in the screenshot below appears as a single "l" group
let g:which_key_map.l = { \ 'name' : '+lsp' , \ 'd' : ['Lua("vim.lsp.buf.definition()")' , 'definition'], ..... \ }
However given the amount of keybindings enabled by Paredit and slimv by default it pollutes the menu somewhat. In this case the steps would be to disable the keybindings for the plugin and build them again using an object just like above. I have attached a couple of screenshots to show how with slimv enabled the which-key leader menu is less readable.
So two questions.
Thanks
Thank you for the explanation. When you say you want to disable all keybindings, do you mean only the bindings starting with <leader>
or do you mean all bindings, including such as (
, )
, Enter
, Backspace
, Del
, "
, x
, s
, d
, c
, p
, etc?
Regarding your questions:
|
and followed by the repeat#set
stuff, but keeping the <CR>
at the end. So in case of :<C-U>call PareditMoveRight()|silent! call repeat#set(",>")<CR>
you can use :<C-U>call PareditMoveRight()<CR>
(but I think it's easier just to leave the command as is). The whole vim map command is then: nnoremap <buffer> <silent> <leader>> :<C-U>call PareditMoveRight()<CR>
. The |
is just a command separator, and the followed repeat#set
command is either executed (if the plugin is installed) or just silently isn't doing anything.Thankyou for this.
I am tempted to leave it all as is. It would just be great to get them named nicely in the which-key config so its all easier to read.
Should I leave this open and we can close it when you have had time to add the option you spoke about to paredit?
Thanks so much.
I added two new options: g:paredit_map_func
and g:paredit_unmap_func
in commit https://github.com/kovisoft/slimv/commit/de657dd6e124189143589a725ae85113c09eb053 . You can define your own custom keybinding mapping and unmapping functions here. The mapping function is called at buffer initialization and upon switching paredit mode on again (via ,(
). The unmapping function is called upon switching paredit mode off (also via ,(
).
Example usage:
let g:paredit_map_func='MyPareditMapKeys'
let g:paredit_unmap_func='MyPareditUnmapKeys'
function! MyPareditMapKeys()
execute 'nnoremap <buffer> <silent> ' . g:paredit_leader.'J :<C-U>call PareditJoin()<CR>'
endfunction
function! MyPareditUnmapKeys()
silent! execute 'unmap <buffer> ' . g:paredit_leader . 'J'
endfunction
By default functions PareditMapKeys
and PareditUnmapKeys
are used, you can find the assigned mappings in these functions. Please check if these options solve this issue.
Maybe this is worth a separate ticket, but which-key.nvim appears to also have issues, even when explicitly calling :call SlimvEvalDefun()
-- instead of doing the thing, it puts me into insert mode on the following line. I haven't had time to dig deeper, but does this seem directly related to the issue with vim-which-key or worth making a separate ticket for?
TBH I still don't know much about which-key (and, as a matter of fact, about nvim), but as I understand it handles keybindings, so if you experience problems also when directly entering the command (without using any keybinding), then this issue does not seem to be related with which-key.
@Kingsy can you see if #140 resolves this as well? (I strongly suspect it does; if not, can you send the output of :map v
?)
Hi,
Have you had experience using this plugin with which-key? It seems to have a lot of default key bindings which pollute the which-key leader and local leader menus. Is it possible to disable all key bindings somehow so I can create my own menu map with which-key?
If so is there a list of commands somewhere I can use when rebinding the key bindings? At the moment they appear as so in which-key
I am not sure 'call PareditMoveRight()|silent! call repeat#set("\>")' would work as the key binding would it?
Just want to clarify this, cant find much info on it.
Thanks