Closed hoofcushion closed 1 month ago
the log file:
Debug Started for v3.7.0
new Mode(n:1)
Trigger(add) Mode(n:1) ' " ` z= g` g' <Space> ] [ <C-W> z g
on_key: <Space>
State(start): Mode(n:0) Node(<Space>) { keys = "<Space>", waited = 0 }
update Mode(n:1)
continue: <Space> Mode(n:1)
getchar
on_key: <Esc>
got: <Esc>
on_key: a
ModeChanged(n:i)
new Mode(i:1)
Safe(true)
Trigger(add) Mode(i:1) <C-R>
on_key: <Esc>
ModeChanged(i:n)
Safe(true)
on_key: b
on_key: <Esc>
on_key: c
ModeChanged(n:no)
new Mode(o:1)
Unsafe(pending "^[")
suspend: Mode(o:1)
on_key: <Esc>
ModeChanged(no:n)
cooldown
Trigger(add) Mode(o:1) g ] [
on_key: d
ModeChanged(n:no)
Unsafe(pending "^[")
suspend: Mode(o:1)
Trigger(del) Mode(o:1) [ ] g
on_key: <Esc>
ModeChanged(no:n)
cooldown
Trigger(add) Mode(o:1) g ] [
on_key: e
on_key: <Esc>
on_key: f
on_key: <Esc>
on_key: g
State(start): Mode(n:0) Node(g) { keys = "g", waited = 0 }
update Mode(n:1)
continue: g Mode(n:1)
getchar
on_key: <Esc>
got: <Esc>
on_key: h
on_key: <Esc>
on_key: i
ModeChanged(n:i)
Unsafe(pending "^[")
suspend: Mode(i:1)
Trigger(del) Mode(i:1) <C-R>
on_key: <Esc>
ModeChanged(i:n)
cooldown
Trigger(add) Mode(i:1) <C-R>
on_key: j
on_key: <Esc>
on_key: k
on_key: <Esc>
on_key: l
on_key: <Esc>
on_key: m
on_key: <Esc>
on_key: n
on_key: <Esc>
on_key: o
ModeChanged(n:i)
Unsafe(pending "^[")
suspend: Mode(i:1)
Trigger(del) Mode(i:1) <C-R>
on_key: <Esc>
ModeChanged(i:n)
cooldown
Trigger(add) Mode(i:1) <C-R>
on_key: p
on_key: <Esc>
on_key: q
on_key: <Esc>
on_key: r
on_key: <Esc>
on_key: s
ModeChanged(n:no)
Unsafe(pending "l")
suspend: Mode(o:1)
Trigger(del) Mode(o:1) [ ] g
ModeChanged(no:i)
cooldown
on_key: <Esc>
ModeChanged(i:n)
cooldown
Trigger(add) Mode(o:1) g ] [
on_key: t
on_key: <Esc>
on_key: u
on_key: <Esc>
on_key: v
ModeChanged(n:v)
new Mode(x:1)
Unsafe(pending "^[")
suspend: Mode(x:1)
on_key: <Esc>
ModeChanged(v:n)
cooldown
Trigger(add) Mode(x:1) " ] [ <C-W> g z
on_key: w
on_key: <Esc>
on_key: x
ModeChanged(n:no)
Unsafe(pending "l")
suspend: Mode(o:1)
Trigger(del) Mode(o:1) g ] [
ModeChanged(no:n)
cooldown
on_key: <Esc>
Trigger(add) Mode(o:1) g ] [
on_key: y
ModeChanged(n:no)
Unsafe(pending "^[")
suspend: Mode(o:1)
Trigger(del) Mode(o:1) g ] [
on_key: <Esc>
ModeChanged(no:n)
cooldown
Trigger(add) Mode(o:1) g ] [
on_key: z
State(start): Mode(n:0) Node(z) { keys = "z", waited = 0 }
update Mode(n:1)
continue: z Mode(n:1)
getchar
on_key: <Esc>
got: <Esc>
on_key: :
ModeChanged(n:c)
new Mode(c:1)
Safe(true)
Trigger(add) Mode(c:1) <C-R>
on_key: q
on_key: a
on_key: <CR>
ModeChanged(c:n)
Unsafe(command-mode)
suspend: Mode(n:1)
Trigger(del) Mode(n:1) g ' " ` z= g` g' <Space> ] [ <C-W> z
on_key: <CR>
Trigger(add) Mode(n:1) ' " ` z= g` g' <Space> ] [ <C-W> z g
on_key: ;
on_key: :
ModeChanged(n:c)
Safe(true)
on_key: q
on_key: a
on_key: !
on_key: <CR>
ModeChanged(c:n)
Unsafe(command-mode)
suspend: Mode(n:1)
Trigger(del) Mode(n:1) g ' " ` z= g` g' <Space> ] [ <C-W> z
Trigger(add) Mode(n:1) ' " ` z= g` g' <Space> ] [ <C-W> z g
That's on purpose, since the only single letter keys that are not a valid Neovim keymap are g
and z
.
However, I just reworked the whole which-key configuration and you can now trigger on additional keys when needed.
See https://github.com/folke/which-key.nvim?tab=readme-ov-file#-triggers
Thanks for your works.
And I had another question, Can there be an option to use the v1 style auto triggers?
There are plugins that use the a-z as the initial key, and now the Which-Key doesn't work well with them.
Now to do that, I use the whole ASCII table from space to ~, that seems to work like the old version. Does it have to be the way?
local opts={
triggers=(function()
local ret={{"<auto>",mode="nixsotc"}}
for i=32,126 do
table.insert(ret,{string.char(i),mode="nixsotc"})
end
return ret
end)(),
}
require("which-key").setup(opts)
That would prevent builtin mappings from working, so I really wouldn't do that. Just add the letters manually that you need. There's probably only a few.
Okay, thanks.
Did you check docs and existing issues?
Neovim version (nvim -v)
NVIM v0.10.0 Build type: Release LuaJIT 2.1.1713484068
Operating system/version
Arch Linux x86_64 Linux 6.9.7-zen1-1-zen
Describe the bug
Which key does not automatically set up triggers for all keymap that starts with a-z (except z or g).
Steps To Reproduce
Use this configuration file, and try press a-z, only g and z can trigger which key.
Expected Behavior
For all key maps, setup triggers for them automatically, just like the old version. (version 1.0)
Health
Log
No response
Repro