# Macros - neomutt macros for sync, URL extraction, flag legend, and quit { config, lib, ... }: { config.programs.neomutt.macros = lib.mkIf config.communication.neomutt.enable [ { map = [ "index" "pager" ]; 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"; } { # gx: open the message body in interactive chawan -- real vim-style # cursor navigation (hjkl, Tab/Shift-Tab between links, Enter to # follow, B back, q to return to neomutt). Replaces the old # urlscan-based link picker. map = [ "index" "pager" ]; key = "gx"; action = "urlscan"; } { # Ctrl-B in the pager: same interactive chawan view as gx, kept as # a second binding since Ctrl-B is a common muscle-memory key # for "open this in a browser-like view". map = [ "pager" ]; key = "\\Cb"; action = "set my_pipe_decode=$pipe_decode pipe_decode=yes${lib.getExe config.web.chawan.package} -o \"title='neomutt'\"set pipe_decode=$my_pipe_decode"; } { # Ctrl-B on a specific attachment (not just the top-level # message): pipe-entry sends the selected attachment instead. map = [ "attach" ]; key = "\\Cb"; action = "${lib.getExe config.web.chawan.package} -o \"title='neomutt'\" "; } { # 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 = "all"; } { # ZZ: save and quit, vim-style (sync mailbox, then quit) map = [ "index" ]; key = "ZZ"; action = ""; } { # ZQ: quit without saving, vim-style counterpart to ZZ map = [ "index" ]; key = "ZQ"; action = ""; } ]; }