From 302f83b23b364b08dc47725266db5e20437d71e4 Mon Sep 17 00:00:00 2001 From: Arpit Chakladar Date: Sat, 18 Jul 2026 00:30:32 +0530 Subject: feat(neomutt): add vim-style delete/copy keybindings, gf/gF swap, and private configs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add `dd`/`D` delete keybindings (single/thread) with vim-style `d` as prefix - Extend copy (`y`/`yy`) to work in both index and pager views - Add `gT` for previous-unread-mailbox (counterpart to `gt`) - Swap `gf`/`gF` so `gf` limits and `gF` clears filter (via macro) - Fix `binds` → `macros` in macros.nix and add `description` fields - Add `ZQ` (quit without saving) macro alongside existing `ZZ` - Add private email.nix and git.nix with personal account/identity config --- modules/communication/neomutt/keybindings.nix | 49 +++++++++++++++++++++------ modules/communication/neomutt/macros.nix | 22 ++++++++++-- 2 files changed, 59 insertions(+), 12 deletions(-) (limited to 'modules/communication') 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 = "set my_wait_key=$wait_key wait_key=no${lib.getExe config.scripts.neomutt-sync.package}set wait_key=$my_wait_key"; + 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 = "urlscan"; + description = "extract links from message (netrw-style)"; } { map = [ @@ -27,12 +28,29 @@ ]; key = "gl"; action = "less ~/.config/neomutt/flag_legend.txt"; + 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 = "~A"; + description = "clear limit/filter, show all messages"; } { # ZZ: save and quit, vim-style (sync mailbox, then quit) map = [ "index" ]; key = "ZZ"; action = ""; + description = "save changes and quit"; + } + { + # ZQ: quit without saving, vim-style counterpart to ZZ + map = [ "index" ]; + key = "ZQ"; + action = ""; + description = "quit without saving"; } ]; } -- cgit v1.2.3