diff options
| -rw-r--r-- | modules/communication/neomutt/keybindings.nix | 49 | ||||
| -rw-r--r-- | modules/communication/neomutt/macros.nix | 22 |
2 files changed, 59 insertions, 12 deletions
diff --git a/modules/communication/neomutt/keybindings.nix b/modules/communication/neomutt/keybindings.nix index 8fde25e..6b9cdb4 100644 --- a/modules/communication/neomutt/keybindings.nix +++ b/modules/communication/neomutt/keybindings.nix @@ -69,7 +69,7 @@ action = "select-entry"; } - # --- back / exit (vim: h = left/back) --- + # --- back / exit / fold-close (vim: h = left/back) --- { map = [ "pager" ]; key = "h"; @@ -86,6 +86,10 @@ action = "exit"; } { + # in the index, h/l act as fold-close/fold-open on a thread + # rather than "back" (there's nowhere to go "back" to from the + # top-level index) -- same convention as fold/tree keybindings + # in tools like NERDTree or fugitive. map = [ "index" ]; key = "h"; action = "collapse-thread"; @@ -221,6 +225,24 @@ action = "search-opposite"; } + # --- delete / undelete (vim: dd delete line, u undo) --- + { + map = [ "index" ]; + key = "d"; + action = "noop"; + } + { + map = [ "index" ]; + key = "dd"; + action = "delete-message"; + } + { + # capital D deletes the whole thread, mirroring the v/V + # (single vs. whole-thread) convention used below for tagging + map = [ "index" ]; + key = "D"; + action = "delete-thread"; + } { map = [ "index" @@ -233,12 +255,18 @@ # --- copy (vim: yy yank -- non-destructive, unlike save-message # which moves/deletes the original) --- { - map = [ "index" ]; + map = [ + "index" + "pager" + ]; key = "y"; action = "noop"; } { - map = [ "index" ]; + map = [ + "index" + "pager" + ]; key = "yy"; action = "copy-message"; } @@ -259,24 +287,25 @@ action = "tag-thread"; } - # --- mailbox switching (vim: gt = next tab) --- + # --- mailbox switching (vim: gt/gT next/previous tab) --- { map = [ "index" ]; key = "gt"; action = "next-unread-mailbox"; } - - # --- filter/limit (vim: gf to 'find' or 'filter') --- { map = [ "index" ]; - key = "gf"; - action = "limit"; + key = "gT"; + action = "previous-unread-mailbox"; } - # --- filter/limit (vim: gf to 'find' or 'filter') --- + # --- filter/limit (vim: gf to 'find'/'filter') --- + # gF is the "clear filter" counterpart, defined as a macro + # (see macros.nix) since resetting the limit needs a fixed + # pattern rather than an interactive prompt. { map = [ "index" ]; - key = "gF"; + key = "gf"; action = "limit"; } diff --git a/modules/communication/neomutt/macros.nix b/modules/communication/neomutt/macros.nix index ae1d84e..e65436c 100644 --- a/modules/communication/neomutt/macros.nix +++ b/modules/communication/neomutt/macros.nix @@ -1,8 +1,7 @@ # Macros - neomutt macros for sync, URL extraction, flag legend, and quit { config, lib, ... }: - { - config.programs.neomutt.binds = lib.mkIf config.communication.neomutt.enable [ + config.programs.neomutt.macros = lib.mkIf config.communication.neomutt.enable [ { map = [ "index" @@ -10,6 +9,7 @@ ]; key = "O"; action = "<enter-command>set my_wait_key=$wait_key wait_key=no<enter><sync-mailbox><shell-escape>${lib.getExe config.scripts.neomutt-sync.package}<enter><sync-mailbox><enter-command>set wait_key=$my_wait_key<enter>"; + description = "sync mailbox (run neomutt-sync)"; } { # gx: extract links from the current message and open one, vim-netrw style @@ -19,6 +19,7 @@ ]; key = "gx"; action = "<pipe-message>urlscan<Enter>"; + description = "extract links from message (netrw-style)"; } { map = [ @@ -27,12 +28,29 @@ ]; key = "gl"; action = "<shell-escape>less ~/.config/neomutt/flag_legend.txt<enter>"; + description = "show flag legend"; + } + { + # gF: clear the current limit/filter and show every message again, + # the counterpart to gf (interactive limit prompt) in binds.nix + map = [ "index" ]; + key = "gF"; + action = "<limit>~A<enter>"; + description = "clear limit/filter, show all messages"; } { # ZZ: save and quit, vim-style (sync mailbox, then quit) map = [ "index" ]; key = "ZZ"; action = "<sync-mailbox><quit>"; + description = "save changes and quit"; + } + { + # ZQ: quit without saving, vim-style counterpart to ZZ + map = [ "index" ]; + key = "ZQ"; + action = "<exit>"; + description = "quit without saving"; } ]; } |
