nix-config/dots/zsh/default.nix

95 lines
2.5 KiB
Nix
Raw Normal View History

2024-11-10 17:54:08 -05:00
{ pkgs, ... }:
{
programs = {
zoxide = {
enable = true;
enableZshIntegration = true;
options = [
"--cmd cd"
];
};
zsh = {
enable = true;
package = pkgs.zsh;
dotDir = ".config/zsh";
defaultKeymap = "viins";
enableCompletion = true;
autosuggestion.enable = false;
syntaxHighlighting = {
enable = true;
package = pkgs.zsh-syntax-highlighting;
};
history = {
save = 10000;
size = 10000;
ignoreDups = true;
};
historySubstringSearch = {
enable = true;
searchUpKey = "^P";
searchDownKey = "^N";
};
envExtra = ''
export EDITOR=nvim || export EDITOR=vim
export BROWSER=firefox
# Clean up the home folder.
export GCC_COLORS="error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01"
export GNUPGHOME="$XDG_DATA_HOME/gnupg"
export _JAVA_OPTIONS=-Djava.util.prefs.userRoot="$XDG_CONFIG_HOME/java"
export LC_ALL=en_US.UTF-8
export LESSHISTFILE="-"
export MANPAGER="nvim +Man!"
export PARALLEL_HOME="$XDG_CONFIG_HOME/parallel"
export SQLITE_HISTORY="$XDG_DATA_HOME/sqlite_history"
# Add these directories to PATH on shell startup.
PATH=$PATH:$HOME/scripts
PATH=$PATH:$HOME/.local/bin
'';
initExtra = ''
autoload -U colors && colors
# Manually set the prompt.
PS1="
%{$fg[blue]%}%n %{$fg[yellow]%}at %{$fg[blue]%}%m %{$fg[yellow]%}in %{$fg[blue]%}%~
%{$fg[yellow]%}λ%{$reset_color%} "
set -o noclobber
setopt interactive_comments
export KEYTIMEOUT=1
# Use 'k' and 'j' for substring searching when in cmd mode.
bindkey -M vicmd 'k' history-substring-search-up
bindkey -M vicmd 'j' history-substring-search-down
# Use <C-y> for autosuggestions, similar to nvim.
bindkey '^Y' autosuggest-accept
# Cycle back through previous suggestions with <S-Tab>.
bindkey '^[[Z' reverse-menu-complete
'';
shellAliases = {
cp = "cp -i";
mv = "mv -i";
rm = "rm -I";
ls = "ls --color=auto";
cat = "bat -pp";
grep = "grep --color=auto";
diff = "diff --color=auto";
mutt = "neomutt";
song = "yt-dlp --continue --no-check-certificate --format=bestaudio -x --add-metadata --audio-format=flac";
mkdir = "mkdir -p";
};
};
};
}