feat(fish): gate the default shell and prefer abbreviations
Move the login-shell switch behind a new modules.fish.defaultShell option (default false; neogaia opts in). Convert every non-eza alias to an abbreviation, set preferAbbrs and pin generateCompletions, and switch the command line to vi-style editing. Cap navigation at four dots and drop psmem/psmem10/dir/vdir/please. Comment the installed packages.
This commit is contained in:
@@ -32,3 +32,10 @@ Configure the plugins natively through home-manager rather than a fish plugin ma
|
|||||||
- **`copy` kept verbatim** (including the upstream `trim-right` call) to preserve exact parity with the current shell.
|
- **`copy` kept verbatim** (including the upstream `trim-right` call) to preserve exact parity with the current shell.
|
||||||
- **Verification.** The `neogaia` system toplevel builds (the spec's primary seam).
|
- **Verification.** The `neogaia` system toplevel builds (the spec's primary seam).
|
||||||
The rendered `~/.config/fish/` was inspected in the build output: aliases, the three helper functions, the `fastfetch` greeting, the bat manpager, the `done` tuning vars, and the `conf.d/plugin-done.fish` + `conf.d/plugin-bang-bang.fish` plugin files are all present; `users.users.alexion.shell` resolves to `pkgs.fish`.
|
The rendered `~/.config/fish/` was inspected in the build output: aliases, the three helper functions, the `fastfetch` greeting, the bat manpager, the `done` tuning vars, and the `conf.d/plugin-done.fish` + `conf.d/plugin-bang-bang.fish` plugin files are all present; `users.users.alexion.shell` resolves to `pkgs.fish`.
|
||||||
|
|
||||||
|
### Post-review adjustments
|
||||||
|
|
||||||
|
- **`defaultShell` option.** Setting fish as the login shell moved behind `modules.fish.defaultShell` (default `false`, gated with `mkIf`); `neogaia` opts in explicitly. Enabling the Module alone no longer changes the login shell.
|
||||||
|
- **Abbreviation-first.** Every non-eza alias is now a `shellAbbr` (the eza `ls` family stays an alias), `preferAbbrs = true`, and `generateCompletions = true` is pinned rather than left to the upstream default.
|
||||||
|
- **vi command-line editing.** `interactiveShellInit` sets `fish_key_bindings fish_vi_key_bindings`; the `bang-bang` plugin re-binds `!`/`$` in insert mode via its own `--on-variable fish_key_bindings` handler, so the switch keeps them working.
|
||||||
|
- **Trimmed aliases.** Navigation capped at four dots (`.....`/`......` dropped); `psmem`, `psmem10`, `dir`, `vdir`, and `please` removed.
|
||||||
|
|||||||
@@ -37,6 +37,7 @@
|
|||||||
|
|
||||||
# fish as the login shell.
|
# fish as the login shell.
|
||||||
modules.fish.enable = true;
|
modules.fish.enable = true;
|
||||||
|
modules.fish.defaultShell = true;
|
||||||
|
|
||||||
# Locale preferences for the base system.
|
# Locale preferences for the base system.
|
||||||
time.timeZone = "America/New_York";
|
time.timeZone = "America/New_York";
|
||||||
|
|||||||
@@ -4,34 +4,50 @@
|
|||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
# fish for the primary user, configured natively through home-manager and set
|
# fish for the primary user, configured natively through home-manager. Wires the
|
||||||
# as their default login shell. Wires the done and bang-bang plugins, a
|
# done and bang-bang plugins, a fastfetch greeting, a bat-backed manpager, helper
|
||||||
# fastfetch greeting, a bat-backed manpager, helper functions, and the eza and
|
# functions, the eza aliases, and vi-style command-line editing. Set fish as the
|
||||||
# navigation aliases.
|
# default login shell by also turning on `modules.fish.defaultShell`.
|
||||||
let
|
let
|
||||||
cfg = config.modules.fish;
|
cfg = config.modules.fish;
|
||||||
user = config.user.name;
|
user = config.user.name;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.modules.fish.enable = lib.mkEnableOption "fish as the user's shell, configured via home-manager";
|
options.modules.fish = {
|
||||||
|
enable = lib.mkEnableOption "fish as the user's shell, configured via home-manager";
|
||||||
|
|
||||||
|
defaultShell = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
description = "Set fish as the user's default login shell.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
# System-level fish: registers it in /etc/shells and installs vendor
|
# System-level fish: registers it in /etc/shells and installs vendor
|
||||||
# completions.
|
# completions.
|
||||||
programs.fish.enable = true;
|
programs.fish.enable = true;
|
||||||
users.users.${user}.shell = pkgs.fish;
|
users.users.${user}.shell = lib.mkIf cfg.defaultShell pkgs.fish;
|
||||||
|
|
||||||
home-manager.users.${user} = {
|
home-manager.users.${user} = {
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
eza
|
eza # modern ls with git awareness and icons; backs the ls aliases
|
||||||
bat
|
bat # syntax-highlighting cat/pager; backs the manpager below
|
||||||
fastfetch
|
fastfetch # system-info banner printed as the shell greeting
|
||||||
wget
|
wget # non-interactive HTTP downloader; backs the wget abbreviation
|
||||||
];
|
];
|
||||||
|
|
||||||
programs.fish = {
|
programs.fish = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
|
# Relied-on upstream defaults, pinned so a future change can't silently
|
||||||
|
# alter behaviour.
|
||||||
|
generateCompletions = true;
|
||||||
|
|
||||||
|
# Prefer abbreviations over aliases when other modules wire up fish
|
||||||
|
# shortcuts, matching the abbreviation-first style below.
|
||||||
|
preferAbbrs = true;
|
||||||
|
|
||||||
# done notifies when a long command finishes; bang-bang restores the !!
|
# done notifies when a long command finishes; bang-bang restores the !!
|
||||||
# and !$ history bindings.
|
# and !$ history bindings.
|
||||||
plugins = [
|
plugins = [
|
||||||
@@ -45,20 +61,20 @@ in
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# Only the eza listings stay aliases; everything else is an abbreviation.
|
||||||
shellAliases = {
|
shellAliases = {
|
||||||
# Replace ls with eza.
|
|
||||||
ls = "eza -al --color=always --group-directories-first --icons";
|
ls = "eza -al --color=always --group-directories-first --icons";
|
||||||
la = "eza -a --color=always --group-directories-first --icons";
|
la = "eza -a --color=always --group-directories-first --icons";
|
||||||
ll = "eza -l --color=always --group-directories-first --icons";
|
ll = "eza -l --color=always --group-directories-first --icons";
|
||||||
lt = "eza -aT --color=always --group-directories-first --icons";
|
lt = "eza -aT --color=always --group-directories-first --icons";
|
||||||
"l." = "eza -a | grep -e '^\\.'";
|
"l." = "eza -a | grep -e '^\\.'";
|
||||||
|
};
|
||||||
|
|
||||||
|
shellAbbrs = {
|
||||||
# Walk up the tree.
|
# Walk up the tree.
|
||||||
".." = "cd ..";
|
".." = "cd ..";
|
||||||
"..." = "cd ../..";
|
"..." = "cd ../..";
|
||||||
"...." = "cd ../../..";
|
"...." = "cd ../../..";
|
||||||
"....." = "cd ../../../..";
|
|
||||||
"......" = "cd ../../../../..";
|
|
||||||
|
|
||||||
vi = "nvim";
|
vi = "nvim";
|
||||||
vim = "nvim";
|
vim = "nvim";
|
||||||
@@ -68,15 +84,10 @@ in
|
|||||||
tarnow = "tar -acf ";
|
tarnow = "tar -acf ";
|
||||||
untar = "tar -zxvf ";
|
untar = "tar -zxvf ";
|
||||||
wget = "wget -c ";
|
wget = "wget -c ";
|
||||||
psmem = "ps auxf | sort -nr -k 4";
|
|
||||||
psmem10 = "ps auxf | sort -nr -k 4 | head -10";
|
|
||||||
dir = "dir --color=auto";
|
|
||||||
vdir = "vdir --color=auto";
|
|
||||||
grep = "grep --color=auto";
|
grep = "grep --color=auto";
|
||||||
fgrep = "fgrep --color=auto";
|
fgrep = "fgrep --color=auto";
|
||||||
egrep = "egrep --color=auto";
|
egrep = "egrep --color=auto";
|
||||||
jctl = "journalctl -p 3 -xb";
|
jctl = "journalctl -p 3 -xb";
|
||||||
please = "sudo";
|
|
||||||
|
|
||||||
# Rebuild the system, and reclaim disk from old generations.
|
# Rebuild the system, and reclaim disk from old generations.
|
||||||
update = "sudo nixos-rebuild switch";
|
update = "sudo nixos-rebuild switch";
|
||||||
@@ -114,6 +125,9 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
interactiveShellInit = ''
|
interactiveShellInit = ''
|
||||||
|
# vi-style modal editing on the command line.
|
||||||
|
set -g fish_key_bindings fish_vi_key_bindings
|
||||||
|
|
||||||
set -gx EDITOR nvim
|
set -gx EDITOR nvim
|
||||||
set -gx VISUAL nvim
|
set -gx VISUAL nvim
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user