aboutsummaryrefslogtreecommitdiffstats
path: root/modules/communication
diff options
context:
space:
mode:
authorArpit Chakladar <arpitchakladar+git@gmail.com>2026-08-04 20:01:06 +0530
committerArpit Chakladar <arpitchakladar+git@gmail.com>2026-08-04 20:01:06 +0530
commit0a7afa2d1e576f05253b62c6b17e5e4873fbdebc (patch)
tree4aec8cee7c4db281510bc42ff4e214252428afa4 /modules/communication
parent2e0f6163f61cb1e4195f1a08ad1148e57a4f5843 (diff)
downloadhome-manager-config-0a7afa2d1e576f05253b62c6b17e5e4873fbdebc.tar.gz
home-manager-config-0a7afa2d1e576f05253b62c6b17e5e4873fbdebc.zip
feat: moved gpg data directory, other gopass ssh keys, script builder
- Using ~/.local/share/gnupg/ for storing the data for gnupg, and made the necessary changes in all places to that effect - Additional ssh keys can be added to gopass under ssh/, which is on top of the git servers that already existed - Using pkgs.writeShellApplication for creating the scripts, stopped setting path for each dependency (creating a long PATH variable and thus finding binaries may take longer), instead using the inbuild dependency (runtimeInputs) for the scripts
Diffstat (limited to 'modules/communication')
-rw-r--r--modules/communication/neomutt/keybindings.nix357
-rw-r--r--modules/communication/neomutt/macros.nix34
2 files changed, 222 insertions, 169 deletions
diff --git a/modules/communication/neomutt/keybindings.nix b/modules/communication/neomutt/keybindings.nix
index 929d3e2..59712fa 100644
--- a/modules/communication/neomutt/keybindings.nix
+++ b/modules/communication/neomutt/keybindings.nix
@@ -1,14 +1,20 @@
# Keybindings - Vim-style keyboard shortcuts for neomutt
+#
+# Covers the core menus: generic (fallback), index, pager, sidebar,
+# attach, browser, compose. Menus like pgp/smime/mix/postpone/alias/query
+# are intentionally left mostly on defaults - they're rarely touched and
+# not worth risking an incorrect binding for. Press `?` inside neomutt
+# in any menu to see the live, authoritative list of bound functions.
{ config, lib, ... }:
{
config.programs.neomutt.binds = lib.mkIf config.communication.neomutt.enable [
- # --- sidebar navigation (vim: k=up, j=down) ---
+ # --- sidebar navigation (vim: Ctrl-k=up, Ctrl-j=down) ---
{
map = [
"index"
"pager"
];
- key = "\\CK";
+ key = "\\Ck";
action = "sidebar-prev";
}
{
@@ -16,86 +22,87 @@
"index"
"pager"
];
- key = "\\CJ";
+ key = "\\Cj";
action = "sidebar-next";
}
{
- # select the highlighted mailbox directly, no Ctrl+O needed
+ # jump into the highlighted mailbox
map = [
"index"
"pager"
];
- key = "o";
+ key = "\\Co";
action = "sidebar-open";
}
-
- # --- open / go deeper (vim: l = right/forward) ---
{
- map = [ "index" ];
- key = "<Return>";
- action = "display-message";
+ map = [
+ "index"
+ "pager"
+ ];
+ key = "\\Cp";
+ action = "sidebar-prev-new";
}
{
- map = [ "index" ];
- key = "l";
- action = "display-message";
+ map = [
+ "index"
+ "pager"
+ ];
+ key = "\\Cn";
+ action = "sidebar-next-new";
}
{
- map = [ "browser" ];
- key = "<Return>";
- action = "select-entry";
+ # show/hide the sidebar column entirely
+ map = [
+ "index"
+ "pager"
+ ];
+ key = "B";
+ action = "sidebar-toggle-visible";
}
+
+ # --- basic entry navigation (generic = fallback for every list-style menu) ---
{
- map = [ "browser" ];
- key = "l";
- action = "select-entry";
+ map = [ "generic" ];
+ key = "j";
+ action = "next-entry";
}
{
- map = [ "attach" ];
- key = "<Return>";
- action = "view-attach";
+ map = [ "generic" ];
+ key = "k";
+ action = "previous-entry";
}
{
- map = [ "attach" ];
- key = "l";
- action = "view-attach";
+ map = [ "generic" ];
+ key = "gg";
+ action = "first-entry";
}
{
map = [
- "alias"
- "query"
+ "index"
+ "generic"
];
- key = "<Return>";
- action = "select-entry";
+ key = "G";
+ action = "last-entry";
}
- # --- back / exit / fold-close (vim: h = left/back) ---
- {
- map = [ "pager" ];
- key = "h";
- action = "exit";
- }
+ # --- scroll-to-position, straight from vim (zt/zz/zb) ---
{
- map = [ "browser" ];
- key = "h";
- action = "exit";
+ map = [ "generic" ];
+ key = "zt";
+ action = "current-top";
}
{
- map = [ "attach" ];
- key = "h";
- action = "exit";
+ map = [ "generic" ];
+ key = "zz";
+ action = "current-middle";
}
{
- # 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";
+ map = [ "generic" ];
+ key = "zb";
+ action = "current-bottom";
}
- # --- pager line scrolling (vim: j/k move by line) ---
+ # --- pager scrolling ---
{
map = [ "pager" ];
key = "j";
@@ -107,26 +114,6 @@
action = "previous-line";
}
{
- # kept from before: jump straight to the next unread message,
- # extends the h/l "back/forward" metaphor already in use
- map = [ "pager" ];
- key = "l";
- action = "next-unread";
- }
-
- # --- top/bottom of buffer (vim: gg/G -- NOT 0/$, which mean
- # start/end of *line* in vim and would be a false friend here) ---
- {
- map = [ "index" ];
- key = "gg";
- action = "first-entry";
- }
- {
- map = [ "index" ];
- key = "G";
- action = "last-entry";
- }
- {
map = [ "pager" ];
key = "gg";
action = "top";
@@ -137,63 +124,61 @@
action = "bottom";
}
{
- map = [ "browser" ];
- key = "gg";
- action = "first-entry";
- }
- {
- map = [ "browser" ];
- key = "G";
- action = "last-entry";
- }
-
- # --- page scrolling (vim: Ctrl-f/b full page, Ctrl-d/u half page) ---
- {
- map = [ "pager" ];
- key = "\\Cf";
- action = "next-page";
- }
- {
- map = [ "pager" ];
- key = "\\Cb";
- action = "previous-page";
- }
- {
- map = [ "pager" ];
+ map = [
+ "generic"
+ "index"
+ "pager"
+ ];
key = "\\Cd";
action = "half-down";
}
{
- map = [ "pager" ];
+ map = [
+ "generic"
+ "index"
+ "pager"
+ ];
key = "\\Cu";
action = "half-up";
}
{
- # index has no half-page concept, so Ctrl-d/u fall back to
- # the same full-page scroll as Ctrl-f/b
- map = [ "index" ];
+ map = [
+ "generic"
+ "index"
+ "pager"
+ ];
key = "\\Cf";
action = "next-page";
}
{
+ # NOTE: Ctrl-B is deliberately left unbound in the pager map here -
+ # macros.nix claims it there for the chawan browser-view macro.
map = [ "index" ];
key = "\\Cb";
action = "previous-page";
}
+
+ # --- h/l as "back / go into", vim left/right ---
{
- map = [ "index" ];
- key = "\\Cd";
- action = "half-down";
+ map = [ "pager" ];
+ key = "h";
+ action = "exit";
+ }
+ {
+ map = [ "pager" ];
+ key = "l";
+ action = "view-attachments";
}
{
map = [ "index" ];
- key = "\\Cu";
- action = "half-up";
+ key = "l";
+ action = "display-message";
}
- # --- search (vim: / forward, ? backward, n/N repeat) ---
+ # --- search (mostly default already, restated for a complete reference) ---
{
map = [
+ "generic"
"index"
"pager"
];
@@ -202,6 +187,7 @@
}
{
map = [
+ "generic"
"index"
"pager"
];
@@ -210,6 +196,7 @@
}
{
map = [
+ "generic"
"index"
"pager"
];
@@ -218,6 +205,7 @@
}
{
map = [
+ "generic"
"index"
"pager"
];
@@ -225,90 +213,147 @@
action = "search-opposite";
}
- # --- undelete ---
- {
- # 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";
- }
+ # --- delete / undelete, vim dd ---
{
map = [
"index"
"pager"
];
+ key = "dd";
+ action = "delete-message";
+ }
+ {
+ map = [ "index" ];
+ key = "dT";
+ action = "delete-thread";
+ }
+ {
+ map = [ "index" ];
key = "u";
action = "undelete-message";
}
-
- # --- copy (vim: yy yank -- non-destructive, unlike save-message
- # which moves/deletes the original) ---
{
- map = [
- "index"
- "pager"
- ];
- key = "y";
- action = "noop";
+ map = [ "index" ];
+ key = "U";
+ action = "undelete-thread";
}
{
- map = [
- "index"
- "pager"
- ];
- key = "yy";
- action = "copy-message";
+ map = [ "attach" ];
+ key = "dd";
+ action = "delete-entry";
+ }
+ {
+ map = [ "attach" ];
+ key = "u";
+ action = "undelete-entry";
+ }
+
+ # --- limit / filter the index, gf = filter, gF = clear filter ---
+ {
+ # prompts for a limit pattern; macros.nix binds gF to clear it
+ map = [ "index" ];
+ key = "gf";
+ action = "limit";
}
- # --- tagging (vim: v/V visual select single/whole block) ---
- # NOTE: this overrides neomutt's default "v" (view-attachments).
- # Attachments are still reachable from the pager/index via the
- # mailcap auto-view or the attach menu, but if you want plain
- # "v" back for view-attachments, just delete these two binds.
+ # --- unread / new / flagged navigation ---
{
map = [ "index" ];
- key = "v";
- action = "tag-entry";
+ key = "]";
+ action = "next-unread";
}
{
map = [ "index" ];
- key = "V";
- action = "tag-thread";
+ key = "[";
+ action = "previous-unread";
}
-
- # --- mailbox switching ---
{
map = [ "index" ];
- key = "gt";
- action = "next-unread-mailbox";
+ key = "}";
+ action = "next-new";
}
- # --- 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";
- action = "limit";
+ key = "{";
+ action = "previous-new";
+ }
+ {
+ map = [ "index" ];
+ key = "gn";
+ action = "next-flagged";
+ }
+ {
+ map = [ "index" ];
+ key = "gp";
+ action = "previous-flagged";
}
- # --- help message to show functions and keybindings ---
+ # --- attach menu ---
{
- map = [
- "index"
- "pager"
- "browser"
- "attach"
- ];
- key = "g?";
- action = "help";
+ map = [ "attach" ];
+ key = "l";
+ action = "view-attach";
+ }
+ {
+ map = [ "attach" ];
+ key = "s";
+ action = "save-entry";
+ }
+ {
+ map = [ "attach" ];
+ key = "p";
+ action = "print-entry";
}
+ # --- browser (folder / file picker) ---
{
- map = [ "pager" ];
- key = "H";
- action = "display-toggle-weed";
+ map = [ "browser" ];
+ key = "j";
+ action = "next-entry";
+ }
+ {
+ map = [ "browser" ];
+ key = "k";
+ action = "previous-entry";
+ }
+ {
+ map = [ "browser" ];
+ key = "gg";
+ action = "first-entry";
+ }
+ {
+ map = [ "browser" ];
+ key = "G";
+ action = "last-entry";
+ }
+ {
+ # neomutt has no dedicated "go up a directory" function - the ".."
+ # row is a normal entry, so l/Enter on it goes up just fine
+ map = [ "browser" ];
+ key = "l";
+ action = "select-entry";
+ }
+ {
+ map = [ "browser" ];
+ key = "\\Cd";
+ action = "half-down";
+ }
+ {
+ map = [ "browser" ];
+ key = "\\Cu";
+ action = "half-up";
+ }
+
+ # --- compose menu ---
+ {
+ map = [ "compose" ];
+ key = "j";
+ action = "next-entry";
+ }
+ {
+ map = [ "compose" ];
+ key = "k";
+ action = "previous-entry";
}
];
}
diff --git a/modules/communication/neomutt/macros.nix b/modules/communication/neomutt/macros.nix
index 3fdc769..4a1fd5d 100644
--- a/modules/communication/neomutt/macros.nix
+++ b/modules/communication/neomutt/macros.nix
@@ -3,18 +3,19 @@
{
config.programs.neomutt.macros = lib.mkIf config.communication.neomutt.enable [
{
+ # sync the mailbox and run the external sync script, silencing the
+ # "press any key" prompt around it. Vim mnemonic: g-prefixed, "go sync".
map = [
"index"
"pager"
];
- key = "O";
+ key = "gs";
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>";
}
{
- # 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.
+ # extract every URL from the message via urlscan into a picker menu,
+ # then follow the selected one. Vim mnemonic: gx, same as vim-plugins
+ # that open the link/file under the cursor.
map = [
"index"
"pager"
@@ -23,35 +24,42 @@
action = "<pipe-message>urlscan<enter>";
}
{
- # 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".
+ # 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.
+ # Kept on Ctrl-B since that's common muscle-memory for "open this in
+ # a browser-like view" - previous-page is intentionally NOT bound to
+ # Ctrl-B in the pager (see binds.nix) so this doesn't get shadowed.
map = [ "pager" ];
key = "\\Cb";
action = "<enter-command>set my_pipe_decode=$pipe_decode pipe_decode=yes<enter><pipe-message>${lib.getExe config.web.chawan.package} -o \"title='neomutt'\"<enter><enter-command>set pipe_decode=$my_pipe_decode<enter>";
}
{
- # Ctrl-B on a specific attachment (not just the top-level
+ # on a specific attachment (not just the top-level
# message): pipe-entry sends the selected attachment instead.
+ # Same gx mnemonic as the index/pager macro above.
map = [ "attach" ];
- key = "\\Cb";
+ key = "gx";
action = "<pipe-entry>${lib.getExe config.web.chawan.package} -o \"title='neomutt'\" <enter>";
}
{
- # gF: clear the current limit/filter and show every message again,
+ # 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>all<enter>";
}
{
- # ZZ: save and quit, vim-style (sync mailbox, then quit)
+ # save and quit, vim-style (sync mailbox, then quit) - same ZZ
+ # you'd type in vim to write and exit
map = [ "index" ];
key = "ZZ";
action = "<sync-mailbox><quit>";
}
{
- # ZQ: quit without saving, vim-style counterpart to ZZ
+ # quit without saving, vim-style counterpart to ZZ - same ZQ
+ # you'd type in vim to discard and exit
map = [ "index" ];
key = "ZQ";
action = "<exit>";