How to map key to toggle between executing two commands #496
Replies: 1 comment
-
Try this to see if it works for you: local function entry(st)
if st.sort_by_size then
ya.manager_emit("sort", { "alphabetical", dir_first = true })
st.sort_by_size = false
else
ya.manager_emit("sort", { "size", reverse = true })
st.sort_by_size = true
end
end
return {
entry = entry,
}
[[manager.prepend_keymap]]
on = ["s"]
run = "plugin --sync resort"
desc = "Toggle resort" |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently I have:
but, if possible, I would like to map only
s
to toggle between the two commands. An example of the behaviour I am looking for would be: The initial state would be configured inyazi.toml
(e.g. to the same asS
is mapped to). Then, I presss
, andsort size --reverse
is executed, then I presss
again andsort alphabetical --dir-first
is executed, then I presss
again andsort size --reverse
is executed etc.I feel like this might be possible with the new lua plugin system. Maybe you can help me with the right syntax for th plugin? Thanks!
Beta Was this translation helpful? Give feedback.
All reactions