aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorKoni Marti <koni.marti@gmail.com>2022-04-16 00:43:36 +0200
committerRobin Jarry <robin@jarry.cc>2022-04-17 12:16:38 +0200
commit029ff639293efc34c72139e445a8ff452c1da408 (patch)
treec2f48625aee7a708e25c0fffafeef0b98eff494b /config
parent7a7b9df7632cd18adc7dff544a677060bba67a27 (diff)
downloadaerc-029ff639293efc34c72139e445a8ff452c1da408.tar.gz
binds: allow to bind a command to < and >
Allow to bind to < and > by using \< and \> in binds.conf. Ensure that the single \ can still be properly used to bind to other commands. For example, the following binds would work now: \< = :prev-tab<Enter> \> = :next-tab<Enter> \ = :filter<space> Fixes: https://todo.sr.ht/~rjarry/aerc/37 Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Sebastian LaVine <mail@smlavine.com> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'config')
-rw-r--r--config/bindings.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/config/bindings.go b/config/bindings.go
index 7ff0c24b..4be37dea 100644
--- a/config/bindings.go
+++ b/config/bindings.go
@@ -199,6 +199,14 @@ func ParseKeyStrokes(keystrokes string) ([]KeyStroke, error) {
}
case '>':
return nil, errors.New("Found '>' without '<'")
+ case '\\':
+ tok, _, err = buf.ReadRune()
+ if err == io.EOF {
+ tok = '\\'
+ } else if err != nil {
+ return nil, err
+ }
+ fallthrough
default:
strokes = append(strokes, KeyStroke{
Modifiers: tcell.ModNone,