You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This feature is inspired by abbr in Vim and in the fish shell as well as Vim's map commands, e.g. imap or nnoremap. It also makes use of Vim's <leader> key concept that's used in the map commands.
Without the fake keys feature, this was not feasible because the keyberon library is used to process actions. To easily generate an arbitrary action, a key needs to be pressed since kanata doesn't have any knowledge of how to process non-Custom actions. Now that fake keys are added, this feature seems feasible since a fake key is guaranteed to not interact with physical keypresses and thus a tap of a fake key is a good way to execute arbitrary actions.
The proposed changes are:
add a new definition item defseq
this will take a fake key name as the first parameter
the following parameter is a list of normal keys (e.g. (lctl a b c))
add a new special action similar to live reload's lrld: sequence leader sldr.
If sldr is pressed and followed by normal keys in the correct order, the fake key gets tapped
Example configuration entries:
(defseq git-status (g s t))
(deffakekeys git-status (macro g i t spc s t a t u s)
(defalias als (tap-hold 200 200 sldr ralt))
Tapping the keys in order: ralt g s t will result in git status being typed by kanata.
Implementation details
all defseq sequences are parsed into a trie
for simplicity, a non-leaf node is not allowed to have an action associated with it
this is not how Vim *map commands work
e.g. (defseq fk1 a b c) and (defseq fk2 a b) will be rejected
when a sequence leader key sldr is pressed, switch the processing loop mode to a sequence mode where it does not send key inputs and instead traverse the trie using key inputs
when a sequence not in the trie is encountered, exit sequence mode
when a sequence in the trie ends up on a leaf node, tap the fake key and exit sequence mode
defcfg configurable timeout for sequence timeout?
The text was updated successfully, but these errors were encountered:
Feature description
This feature is inspired by
abbr
in Vim and in the fish shell as well as Vim's map commands, e.g.imap
ornnoremap
. It also makes use of Vim's<leader>
key concept that's used in the map commands.Without the fake keys feature, this was not feasible because the keyberon library is used to process actions. To easily generate an arbitrary action, a key needs to be pressed since kanata doesn't have any knowledge of how to process non-
Custom
actions. Now that fake keys are added, this feature seems feasible since a fake key is guaranteed to not interact with physical keypresses and thus atap
of a fake key is a good way to execute arbitrary actions.The proposed changes are:
defseq
(lctl a b c)
)lrld
: sequence leadersldr
.sldr
is pressed and followed by normal keys in the correct order, the fake key gets tappedExample configuration entries:
Tapping the keys in order:
ralt g s t
will result ingit status
being typed by kanata.Implementation details
defseq
sequences are parsed into a trie*map
commands work(defseq fk1 a b c)
and(defseq fk2 a b)
will be rejectedsldr
is pressed, switch the processing loop mode to a sequence mode where it does not send key inputs and instead traverse the trie using key inputsThe text was updated successfully, but these errors were encountered: