unimpaired-which-key.nvim is a bridge between vim-unimpaired and which-key.nvim
- Which-key compatible tables with descriptions of the various vim-unimpaired mappings.
Install the plugin with your preferred package manager, and set tpope/vim-unimpaired
as a dependency like shown below:
require("lazy").setup({
{ "afreakk/unimpaired-which-key.nvim"
, dependencies = { "tpope/vim-unimpaired" }
, config = function()
local wk = require("which-key")
local uwk = require("unimpaired-which-key")
wk.register(uwk.normal_mode)
wk.register(uwk.normal_and_visual_mode, { mode = { "n", "v" } })
end
},
})
Another options is using it as a dependency of which-key like this:
require("lazy").setup({
{ "folke/which-key.nvim"
, dependencies = { "afreakk/unimpaired-which-key.nvim" }
, config = function()
local wk = require("which-key")
wk.setup({
-- whatever options you got
})
local uwk = require("unimpaired-which-key")
wk.register(uwk.normal_mode)
wk.register(uwk.normal_and_visual_mode, { mode = { "n", "v" } })
end
},
})
If you prefer another method, no problem - this plugin is designed to simply provide you with helpful which-key compatible tables.
unimpaired-which-key
gives you two tables, and that's all it does
normal_and_visual_mode
contains the decoders/encoders, which can be used in both normal and visual modenormal_mode
contains the rest of the mappings, and they can only be used in normal mode
Because (I think) vim-unimpaired binds using <plug>
weird stuff, vim.o.timeoutlen
has to expire, before you move on to submenus, like yo
, ]o
, for those sub-menus to show in which-key.
The mappings will still work if you don't wait, but if you do yo
before vim.o.timeoutlen
has expired, you won't see any which-key menu. ¯_(ツ)_/¯
Also, for some reason, if you lazy-load vim-unimpaired on keys = { "[", "]", "y", "=", "<lt>", ">" }
for instance, vim-unimpaired doesn't work ¯_(ツ)_/¯