Files
nixos-config/modules/user/base.nix
T
kiskaadee 53847d3496 refactor(input): harmonize word deletion and modifier keybindings across bash, nvim, tmux, and alacritty
This commit standardizes and refines word deletion behavior and modifier key handling across the entire terminal and editor stack.

- Bash: Add interactive Readline keybindings for `Ctrl+W`, `Ctrl+Delete`, and `Ctrl+Backspace` word deletion.
- Neovim: Configure precision word deletion shortcuts in insert and normal modes.
- Tmux: Enable `extended-keys` and terminal feature flags to pass modifier combos.
- Alacritty: Bind `Ctrl+Delete` and `Ctrl+Back` to raw ANSI escape sequences.
2026-08-30 09:51:58 -05:00

264 lines
9.1 KiB
Nix

# 🛠️ User Base Shell & Git Environment
# This module defines the foundation of the interactive user shell, command line utilities,
# custom shell scripts, aliases, and Git workflows.
{ pkgs, ...}:
{
programs = {
# 🌟 Git Version Control Configuration
# Declares default user identity, global conflict styles, and highly optimized git aliases
git = {
enable = true;
settings = {
user = {
name = "kiskaadee";
email = "fcortesbio@gmail.com";
};
alias = {
st = "status";
co = "checkout";
br = "branch";
# Undo/Modify
unstage = "reset HEAD --";
amend = "commit --amend --no-edit";
undo = "reset --soft HEAD~1";
# Workflow
sync = "!git fetch -p && git pull";
main = "checkout main";
last = "log -1 HEAD";
# Extra aliases from legacy git-ready
dc = "!f() { git diff \"$@\" | wl-copy; }; f";
acp = "!f() { git add -A && git commit -m \"$2\" && git push origin \"$1\"; }; f";
nuke = "!f() { git reset --hard origin/$(git rev-parse --abbrev-ref HEAD) && git clean -fd; }; f";
lg = "log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all";
standup = "!git log --since='24 hours ago' --oneline --author=\"$(git config user.email)\"";
gsp = "!git stash && git pull";
gfo = "fetch origin";
gcredential = "config credential.helper store";
};
core.editor = "nvim";
init.defaultBranch = "main";
merge.conflictstyle = "zdiff3";
pull.rebase = true;
};
};
delta = {
enable = true;
enableGitIntegration = true;
options = {
navigate = true;
side-by-side = true;
line-numbers = true;
hyperlinks = true;
};
};
# ⚡ Direnv - Automatic environment loading
# Automatically activates nix development shells when entering project directories containing .envrc
direnv = {
enable = true;
enableBashIntegration = true;
nix-direnv.enable = true;
};
gh = {
enable = true;
settings = {
git_protocol = "ssh";
editor = "nvim";
prompt = "enabled";
aliases = {
co = "pr checkout";
pv = "pr review";
vw = "repo view --web";
};
};
};
# 🔑 SSH Client Configuration
# Declaratively configures SSH client connections and host options
ssh = {
enable = true;
settings = {
laptop = {
HostName = "192.168.1.25";
User = "kiskaadee";
Port = 22;
ServerAliveInterval = 15;
ServerAliveCountMax = 3;
};
};
};
# 🗺️ Navigation & Directory Listing
# Modern replacements for traditional cd, ls, and grep tools.
zoxide = {
enable = true;
enableBashIntegration = true;
options = [
"--cmd cd"
];
};
fzf = {
enable = true;
enableBashIntegration = true;
};
eza = {
enable = true;
enableBashIntegration = true;
extraOptions = ["--group-directories-first" "--header" "--icons"];
};
tealdeer = {
enable = true;
settings.updates.auto_update = true;
};
# Catppuccin syntax-highlighted cat replacement
bat = {
enable = true;
};
# 🐚 Bash Shell Configuration
# Bridges the Arch 'bash-custom' environment to NixOS, defining aliases and sourcing modular scripts.
bash = {
enable = true;
enableCompletion = true; # Enable programmable auto-completion for system commands
# Shell Aliases for speed, productivity, and command overrides
shellAliases = {
appctl = "/home/kiskaadee/Deployments/traefik-deployments/appctl";
zed = "zeditor";
reload = "exec bash";
ff = "fastfetch --logo none";
# System Navigation
".." = "cd ..";
"..." = "cd ../..";
"...." = "cd ../../..";
"....." = "cd ../../../..";
# System Administration
nix-switch = "sudo nixos-rebuild switch --flake ~/Config#$(hostname)";
server-on = "sudo /run/current-system/specialisation/server/bin/switch-to-configuration switch";
server-off = "sudo /run/current-system/bin/switch-to-configuration switch";
sys = "dgop";
wifi = "nmtui";
lock = "hyprlock";
# Audio Control
vol1 = "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.2";
vol2 = "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.4";
vol3 = "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.6";
vol4 = "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.8";
vol5 = "wpctl set-volume @DEFAULT_AUDIO_SINK@ 1.0";
volM = "wpctl set-mute @DEFAULT_AUDIO_SINK@ 1";
volU = "wpctl set-mute @DEFAULT_AUDIO_SINK@ 0";
# Network Diagnostics
pgoog = "ping google.com -c 3";
# Python / Py5
p5 = "uv run py5-run-sketch";
p5w = "uv run watchfiles \"py5-run-sketch main.py\"";
# Editor Shorthand
v = "nvim";
clock = "tty-clock";
ql = "quicklinks";
# Interactive Jump helper
zi = "zoxide query -i --preview 'eza --tree --level 2 --color=always {}'";
# Git Shorthand
gs = "git status";
ga = "git add";
gc = "git commit -m";
gp = "git push";
gpl = "git pull";
gst = "git stash";
gsp = "git stash && git pull";
gfo = "git fetch origin";
gcheck = "git checkout";
gadc = "git add -A && git diff --staged | wl-copy";
};
# Inject modular shell helper scripts directly into .bashrc.
# This allows us to keep discrete logic files without cluttering home.nix or base.nix.
bashrcExtra = ''
${builtins.readFile ./shell/wayland.sh} # Wayland clipboard helper (wlc)
${builtins.readFile ./shell/git.sh} # Git workflow automations (gacp, gitignore)
${builtins.readFile ./shell/pdf.sh} # Command line PDF decryption helper
${builtins.readFile ./shell/quicklinks.sh} # Interactive fzf web launcher
${builtins.readFile ./shell/jump.sh} # Directory jumper & interactive fuzzy navigation
# --- Word Deletion & Readline Keybindings ---
if [[ -n "$BASH_VERSION" ]] && [[ "$-" == *i* ]]; then
# Ctrl+W: Delete entire word under cursor (backward-word + kill-word)
bind '"\C-w": "\eb\ed"' 2>/dev/null
# Ctrl+Delete: Forward word delete (matches Alacritty \e[3;5~)
bind '"\e[3;5~": kill-word' 2>/dev/null
# Ctrl+Backspace / Alt+Backspace: Backward word delete (start to cursor)
bind '"\e\x7f": backward-kill-word' 2>/dev/null
bind '"\e\b": backward-kill-word' 2>/dev/null
fi
# --- Visual Entry ---
# Display system information dashboard upon opening interactive shells
if [[ $- == *i* ]]; then
fastfetch --logo none
fi
'';
};
};
# 📊 Custom Catnap-style Fastfetch
# A stylized, minimalist system information dashboard displayed on shell startup
programs.fastfetch = {
enable = true;
settings = {
display = {
separator = " ";
};
modules = [
{ key = "╭───────────╮"; type = "custom"; }
{ key = "│  user {#keys}│"; type = "title"; format = "{user-name}"; }
{ key = "│ 󰇅 hname {#keys}│"; type = "title"; format = "{host-name}"; }
{ type = "command"; key = "│ 󱦟 os age {#keys}│"; keyColor = "magenta"; text = "printf \"\\e[0m%s days\\e[0m\" \"$(( ($(date +%s) - $(stat -c %W /)) / 86400 ))\""; }
{ key = "│ 󰅐 uptime {#keys}│"; type = "uptime"; }
{ key = "│ {icon} distro {#keys}│"; type = "os"; }
{ key = "│  kernel {#keys}│"; type = "kernel"; }
{ key = "│  wm {#keys}│"; type = "wm"; }
{ key = "│ 󰇄 desktop {#keys}│"; type = "de"; }
{ key = "│  term {#keys}│"; type = "terminal"; }
{ key = "│  shell {#keys}│"; type = "shell"; }
{ key = "│ 󰍛 cpu {#keys}│"; type = "cpu"; showPeCoreCount = true; }
{ key = "│ 󰉉 root {#keys}│"; type = "disk"; folders = "/"; }
{ key = "│ 󰉉 home {#keys}│"; type = "disk"; folders = "/home"; }
{ key = "│ 󰉉 media {#keys}│"; type = "disk"; folders = "/media"; }
{ key = "│  memory {#keys}│"; type = "memory"; }
{ key = "├───────────┤"; type = "custom"; }
{ key = "│  colors {#keys}│"; type = "colors"; symbol = "circle"; }
{ key = "╰───────────╯"; type = "custom"; }
];
};
};
# Standalone System dependencies
home.packages = with pkgs; [
ripgrep fd glow jq tree wl-clipboard sqlite python3 nodejs
bc qpdf tty-clock grim slurp swappy libnotify uv
curl parallel tuxedo
];
}