Files
dot/modules/home/sh.nix
2026-04-20 12:33:17 +02:00

126 lines
2.9 KiB
Nix

{ config, pkgs, lib, ... }:
let
cfg = config.dot.sh;
in
{
options.dot.sh = {
sourceProfile = lib.mkEnableOption "sourcing of $HOME/.profile in zsh profileExtra";
};
config = {
programs.zsh = {
enable = true;
enableCompletion = true;
autosuggestion.enable = true;
syntaxHighlighting.enable = true;
history.size = 500000;
prezto = {
enable = true;
caseSensitive = true;
color = true;
editor = {
dotExpansion = true;
keymap = "vi";
};
pmodules = [
"environment"
"terminal"
"editor"
"history"
"directory"
"spectrum"
"utility"
"completion"
"ssh"
"syntax-highlighting"
"history-substring-search"
"prompt"
"git"
];
prompt.theme = "minimal";
syntaxHighlighting.highlighters = [
"main"
"brackets"
"pattern"
"line"
"cursor"
"root"
];
tmux = {
autoStartLocal = true;
itermIntegration = true;
};
};
initContent = ''
HISTCONTROL='erasedups:ignoreboth'
HISTIGNORE='&:[ ]*:exit:ls:bg:fg:history:clear'
unsetopt beep
prg() {
# ''${1} is the search term, ''${2} is the path (defaulting to . if empty)
local query="''${1:-}"
local search_path="''${2:-.}"
local selected=$(
fzf --ansi --disabled --query "$query" \
--bind "start:reload(rg --column --line-number --no-heading --color=always --smart-case {q} \"$search_path\")" \
--bind "change:reload:sleep 0.1; rg --column --line-number --no-heading --color=always --smart-case {q} \"$search_path\" || true" \
--delimiter : \
--preview 'bat --color=always --style=numbers --highlight-line {2} {1}' \
--preview-window 'right:45%'
)
# Extract file and line, then open in Neovim
[ -n "$selected" ] && nvim "$(echo "$selected" | cut -d: -f1)" +"$(echo "$selected" | cut -d: -f2)"
}
'';
};
programs.fzf = {
enable = true;
enableZshIntegration = true;
};
programs.lsd = {
enable = true;
enableZshIntegration = true;
};
programs.zoxide = {
enable = true;
enableZshIntegration = true;
options = [
"--cmd cd"
];
};
programs.bat.enable = true;
programs.ripgrep.enable = true;
programs.btop.enable = true;
programs.ranger.enable = true;
home.packages = with pkgs; [
fd
dust
glow
ripgrep-all
viddy
duf
lsof
];
home.sessionVariables = {
BAT_THEME = "Coldark-Cold";
};
home.shellAliases = {
lst = "lsd --tree";
};
};
}