nixos_flake_config/home/zsh.nix

108 lines
2.6 KiB
Nix
Raw Normal View History

2024-04-12 21:48:25 +02:00
{pkgs, ...}: {
2023-07-03 22:35:58 +02:00
programs.z-lua = {
enableAliases = true;
enableZshIntegration = true;
};
programs.zsh = {
autocd = true;
enableCompletion = false;
defaultKeymap = "viins";
shellAliases = {
cfind = "cscope -C -R -L1";
chmod = "chmod -v";
chown = "chown -v";
cp = "cp -v";
rm = "rm -v";
ip = "ip --color=auto";
f = "''$(pay-respects zsh)";
2023-07-03 22:35:58 +02:00
};
history = {
expireDuplicatesFirst = true;
extended = true;
save = 100000;
size = 100000;
};
plugins = [
{
name = "nix_shell";
src = pkgs.zsh-nix-shell;
file = "share/zsh-nix-shell/nix-shell.plugin.zsh";
}
{
name = "nix_completion";
src = pkgs.nix-zsh-completions;
file = "share/zsh/plugins/nix/nix-zsh-completions.plugin.zsh";
}
{
name = "pure_prompt";
src = pkgs.fetchFromGitHub {
owner = "sindresorhus";
repo = "pure";
2024-03-16 21:55:03 +01:00
rev = "a02209d36c8509c0e62f44324127632999c9c0cf";
hash = "sha256-BmQO4xqd/3QnpLUitD2obVxL0UulpboT8jGNEh4ri8k=";
2023-07-03 22:35:58 +02:00
};
file = "pure.plugin.zsh";
}
{
name = "fzf";
src = pkgs.fzf-zsh;
file = "share/zsh/plugins/fzf-zsh/fzf-zsh.plugin.zsh";
}
{
name = "zsh-sudo";
src = pkgs.fetchFromGitHub {
owner = "hcgraf";
repo = "zsh-sudo";
rev = "d8084def6bb1bde2482e7aa636743f40c69d9b32";
sha256 = "1dpm51w3wjxil8sxqw4qxim5kmf6afmkwz1yfhldpdlqm7rfwpi3";
};
file = "sudo.plugin.zsh";
}
{
name = "zsh-fast-syntax-highlighting";
src = pkgs.zsh-fast-syntax-highlighting;
file = "share/zsh/site-functions/fast-syntax-highlighting.plugin.zsh";
}
2023-07-03 22:35:58 +02:00
];
envExtra = '''';
initExtra = ''
2024-04-12 21:48:25 +02:00
# binds
bindkey '^K' fzf-file-widget
2023-07-03 22:35:58 +02:00
2024-04-12 21:48:25 +02:00
# options
setopt nobeep
setopt nopromptcr
setopt c_bases
setopt completeinword
setopt completealiases
setopt notify
2023-07-03 22:35:58 +02:00
2024-04-12 21:48:25 +02:00
#
RPS1=""
2023-07-03 22:35:58 +02:00
2024-04-12 21:48:25 +02:00
#
function chpwd() {
ls;
}
2023-07-03 22:35:58 +02:00
2024-04-12 21:48:25 +02:00
eval "$(direnv hook zsh)"
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
2023-11-19 12:09:51 +01:00
2024-04-12 21:48:25 +02:00
if [[ -n "$PS1" ]] && [[ -z "$TMUX" ]] && [[ -n "$SSH_CONNECTION" ]]; then
TMUX_EXE="${pkgs.tmux}/bin/tmux"
systemd-run --scope --user $TMUX_EXE attach-session -t $USER || systemd-run --scope --user $TMUX_EXE new-session -s $USER
fi
2024-04-01 11:31:40 +02:00
2024-04-12 21:48:25 +02:00
if [[ -n "$BUBBLEWRAP_DIR" ]]; then
RPS1="{{$BUBBLEWRAP_DIR}}"
fi
2023-07-03 22:35:58 +02:00
'';
};
}