Files
nix-config/users/jordan/common/shell.nix
Jordan Holt 0aecdd6b87
All checks were successful
Check flake / build-amd64-linux (push) Successful in 1m33s
treewide: update to NixOS 25.05
2025-05-24 11:55:47 +01:00

189 lines
4.2 KiB
Nix

{
lib,
pkgs,
...
}:
let
inherit (lib)
mkMerge
mkOrder
;
in
{
programs = {
zsh = {
enable = true;
autocd = true;
autosuggestion = {
enable = true;
strategy = [ "completion" ];
};
defaultKeymap = "viins";
dotDir = ".config/zsh";
enableCompletion = true;
enableVteIntegration = true;
history = {
append = true;
extended = true;
ignoreAllDups = true;
ignoreDups = true;
ignoreSpace = true;
save = 1000000;
size = 1000000;
};
initContent =
let
zshConfigBeforeCompInit = mkOrder 550 ''
setopt HASH_LIST_ALL
'';
zshConfig = mkOrder 1000 ''
## Colors
autoload -U colors && colors
## Directories
setopt AUTO_PUSHD
setopt CDABLE_VARS
setopt PUSHD_IGNORE_DUPS
setopt PUSHD_SILENT
setopt PUSHD_TO_HOME
## Expansion and globbing
setopt EXTENDED_GLOB
unsetopt GLOB_DOTS
unsetopt NOMATCH
## History
setopt BANG_HIST
setopt HIST_VERIFY
setopt INC_APPEND_HISTORY_TIME
## I/O
setopt INTERACTIVE_COMMENTS
setopt MULTIOS
unsetopt CLOBBER
## Jobs
setopt LONG_LIST_JOBS
setopt AUTO_RESUME
unsetopt BG_NICE
unsetopt NOTIFY
unsetopt HUP
unsetopt CHECK_JOBS
## Shell emulation
setopt APPEND_CREATE
## Prompt
PS1="%B%{$fg[magenta]%}%~%{$reset_color%} $%b "
## Vi mode
export KEYTIMEOUT=1
## Zsh line editor
unsetopt BEEP
'';
in
mkMerge [
zshConfigBeforeCompInit
zshConfig
];
localVariables = {
# Prevent zsh-vi-mode overriding other keybinds
ZVM_INIT_MODE = "sourcing";
};
plugins = with pkgs; [
{
name = "zsh-vi-mode";
src = zsh-vi-mode;
file = "share/zsh-vi-mode/zsh-vi-mode.plugin.zsh";
}
{
name = "fast-syntax-highlighting";
src = zsh-fast-syntax-highlighting;
file = "share/zsh/site-functions/fast-syntax-highlighting.plugin.zsh";
}
{
name = "jq-zsh-plugin";
src = jq-zsh-plugin;
file = "share/jq-zsh-plugin/jq.plugin.zsh";
}
{
name = "zsh-autopair";
src = zsh-autopair;
file = "share/zsh/zsh-autopair/autopair.zsh";
}
{
name = "zsh-forgit";
src = zsh-forgit;
file = "share/zsh/zsh-forgit/forgit.plugin.zsh";
}
{
name = "zsh-fzf-tab";
src = zsh-fzf-tab;
file = "share/fzf-tab/fzf-tab.plugin.zsh";
}
];
sessionVariables = {
MODE_INDICATOR = "";
MODE_CURSOR_VIINS = "#b77ee0 blinking bar";
MODE_CURSOR_REPLACE = "$MODE_CURSOR_VIINS #ff3334";
MODE_CURSOR_VICMD = "#b77ee0 block";
MODE_CURSOR_SEARCH = "#e7c547 steady underline";
MODE_CURSOR_VISUAL = "$MODE_CURSOR_VICMD steady bar";
MODE_CURSOR_VLINE = "$MODE_CURSOR_VISUAL #54ced6";
ZVM_LINE_INIT_MODE = "i";
};
shellAliases = {
# Verbose file operations
cp = "cp -iv";
mv = "mv -iv";
rm = "rm -v";
mkdir = "mkdir -v";
# Colorize commands
ls = "ls -h --color=auto --group-directories-first";
# Abbreviations
e = "$EDITOR";
f = "$FILE";
g = "git";
m = "neomutt";
n = "$FILE";
v = "$EDITOR";
};
};
broot.enable = true;
direnv = {
enable = true;
nix-direnv.enable = true;
};
fzf = {
enable = true;
enableZshIntegration = true;
package = pkgs.unstable.fzf;
};
mcfly.enable = true;
navi.enable = true;
nix-index.enable = true;
};
home.packages = with pkgs; [
bat
btop
fd
jq
nix-zsh-completions
nnn
ripgrep
];
}