Cassin01 / wf.nvim

A modern which-key for neovim
MIT License
213 stars 3 forks source link

How to replicate this from Which-Key #121

Open hrqmonteiro opened 5 months ago

hrqmonteiro commented 5 months ago

How to do this (from which-key) in wf?

wk.register({
 o = {
     name = "open",
     ["-"] = { ":Oil<CR>", "Oil" },
     p = { ":Neotree toggle<CR>", "Project sidebar" },
     t = { ":ToggleTerm<CR>", "Toggle terminal" }
   },
 }, { prefix = "<Leader>", silent = true })

Tried this:

vim.keymap.set(
  "n",
  "<Space>o",
  register(),
  { noremap = true, silent = true, desc = "[open]" }
)

map("n", "<Leader>o-", ":Oil<CR>", { silent = true, desc = "Oil" })

But when i open WF, it shows one above the other.

image

I want to press Leader, WF to show, and it only show [open] in the list, and only if i press "O", then it shows the keybinding associated with it.

Now showing the [open] and the "Oil" above from it. It doesn't make sense. Oil should be "inside" [open] since it starts with <Leader>o, and it is a register.

Cassin01 commented 5 months ago

Hello @hrqmonteiro,

Thank you for message. This is in a specification. wf.nvim is designed to "clearly indicate to the user when it is executed by the next key". This is to prevent the user from unintended behavior.

Sorry for the inconvenience.