aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--commands/account/expand-folder.go42
-rw-r--r--config/binds.conf2
-rw-r--r--doc/aerc.1.scd4
3 files changed, 48 insertions, 0 deletions
diff --git a/commands/account/expand-folder.go b/commands/account/expand-folder.go
new file mode 100644
index 00000000..3eafaa09
--- /dev/null
+++ b/commands/account/expand-folder.go
@@ -0,0 +1,42 @@
+package account
+
+import (
+ "errors"
+ "fmt"
+
+ "git.sr.ht/~rjarry/aerc/widgets"
+)
+
+type ExpandCollapseFolder struct{}
+
+func init() {
+ register(ExpandCollapseFolder{})
+}
+
+func (ExpandCollapseFolder) Aliases() []string {
+ return []string{"expand-folder", "collapse-folder"}
+}
+
+func (ExpandCollapseFolder) Complete(aerc *widgets.Aerc, args []string) []string {
+ return nil
+}
+
+func (ExpandCollapseFolder) Execute(aerc *widgets.Aerc, args []string) error {
+ if len(args) > 1 {
+ return expandCollapseFolderUsage(args[0])
+ }
+ acct := aerc.SelectedAccount()
+ if acct == nil {
+ return errors.New("No account selected")
+ }
+ if args[0] == "expand-folder" {
+ acct.Directories().ExpandFolder()
+ } else {
+ acct.Directories().CollapseFolder()
+ }
+ return nil
+}
+
+func expandCollapseFolderUsage(cmd string) error {
+ return fmt.Errorf("Usage: %s", cmd)
+}
diff --git a/config/binds.conf b/config/binds.conf
index 98f855a6..7d8d32f9 100644
--- a/config/binds.conf
+++ b/config/binds.conf
@@ -24,6 +24,8 @@ G = :select -1<Enter>
J = :next-folder<Enter>
K = :prev-folder<Enter>
+H = :collapse-folder<Enter>
+L = :expand-folder<Enter>
v = :mark -t<Enter>
V = :mark -v<Enter>
diff --git a/doc/aerc.1.scd b/doc/aerc.1.scd
index c1b16778..8b7be82c 100644
--- a/doc/aerc.1.scd
+++ b/doc/aerc.1.scd
@@ -269,6 +269,10 @@ message list, the message in the message viewer, etc).
Cycles to the next (or previous) folder shown in the sidebar, repeated n
times (default: 1).
+*expand-folder*, *collapse-folder*
+ Expands or collapses the current folder when the directory tree is
+ enabled.
+
*next-result*, *prev-result*
Selects the next or previous search result.