dotfiles-nix/nix/users/base/zsh.nix
2023-10-13 15:56:14 +02:00

30 lines
784 B
Nix

{ config, ... }:
{
programs.zsh = {
enable = true;
autocd = true;
enableAutosuggestions = true;
enableCompletion = true;
syntaxHighlighting.enable = true;
dotDir = "~/.config/zsh";
history.path = "~/.config/zsh/.zsh_history";
initExtra = ''
setopt appendhistory
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
setopt PROMPT_SUBST
PROMPT='%B%F{183}%m%f%F{111}[%f%F{158}%~%f%F{111}]%f%F{111}$(parse_git_branch)%f %F{183}>%f%f%b '
if [[ "$TERM" == "dumb" ]]
then
unsetopt zle
unsetopt prompt_cr
unsetopt prompt_subst
unfunction precmd
unfunction preexec
PS1='$ '
fi
'';
};
}