Conflicting group names
Is it possible to have conflicting group names for a same prefix, such as:
local wk = require("which-key")
local keys = {
["f"] = {
name = "Quickfix list",
n = { "<Plug>(qf_qf_next)", "Next value in quickfix list" },
p = { "<Plug>(qf_qf_previous)", "Previous value in quickfix list" },
},
["l"] = {
name = "Location list",
n = { "<Plug>(qf_loc_next)", "Next value in location list" },
p = { "<Plug>(qf_loc_previous)", "Previous value in location list" },
},
["t"] = {
name = "Toggle",
f = { "<Plus>(qf_qf_toggle)", "Toggle quickfix list" },
f = { "<Plus>(qf_loc_toggle)", "Toggle location list" },
},
}
wk.register(keys, { prefix = "<leader>" })
And
local wk = require("which-key")
local keys = {
f = {
name = "Fuzzy finder",
b = { "<cmd>Buffers<CR>", "Open buffers" },
f = { "<cmd>GFiles<CR>", "Git tracked files" },
},
}
wk.register(keys, { prefix = "<leader>" })
I don't really care about the name shown when using <Leader>, one of them seems to "win the battle", I do not really care about which.
However I would like to have something like multiple columns, one named "Quickfix list" and one named "Fuzzy finder". Is that possible?
I register only the names in my main script and add key-bindings to them in each module without touching the names that works I haven't checked the source but I think it get merges so if you name the same group in different script I suppose the last one will win!
Update: Yes I think its done like I said Look at this
So if you want different names in same context (but some other TUI window) I suppose you could reregister it with an auto command that keeps track of old name and reset it after window is closed.
I'm also facing this issue, I'm trying to set a generic name for the "leader + a + (etc)" which is a call for alignment features with the Tabular plugin, so:
-- tabular, align columns as you wish
M.tabular = {
plugin = true,
[''] = {
["<leader>a"] = { name = "+align" },
["<leader>a,"] = { ":Tabularize /,\\zs<CR>", "Align columns after the ," },
["<leader>a ,"] = { ":Tabularize /,\\zs<CR>", "Align columns with the ," },
},
}
Here I want to have it appearing as an "+align" group name, but it always appears "+prefix" instead, even worse when I have the "name" line included it throws an error
Note that I have tried all the combination structures from the :help pages without success, for example like:
[''] = {
["<leader>a"] = {
name = "+align",
n = { "<cmd>something....<cr>", "Align the N char" },
},
},
result always shows like:
