Skip to content

Instantly share code, notes, and snippets.

@jottr
Created August 30, 2024 20:35
Show Gist options
  • Save jottr/817bb155795337f71cb8c826650d4f56 to your computer and use it in GitHub Desktop.
Save jottr/817bb155795337f71cb8c826650d4f56 to your computer and use it in GitHub Desktop.
typeset -U path cdpath fpath manpath
for profile in ${(z)NIX_PROFILES}; do
fpath+=($profile/share/zsh/site-functions $profile/share/zsh/$ZSH_VERSION/functions $profile/share/zsh/vendor-completions)
done
HELPDIR="/nix/store/i3lac62jigipwhsrjd10zr9z8ihfqmwb-zsh-5.9/share/zsh/$ZSH_VERSION/help"
# Oh-My-Zsh/Prezto calls compinit during initialization,
# calling it twice causes slight start up slowdown
# as all $fpath entries will be traversed again.
autoload -U compinit && compinit
# History options should be set in .zshrc and after oh-my-zsh sourcing.
# See https://github.com/nix-community/home-manager/issues/177.
HISTSIZE="10000"
SAVEHIST="10000"
HISTFILE="/home/jottr/.local/share/zsh/history"
mkdir -p "$(dirname "$HISTFILE")"
setopt HIST_FCNTL_LOCK
unsetopt APPEND_HISTORY
setopt HIST_IGNORE_DUPS
unsetopt HIST_IGNORE_ALL_DUPS
setopt HIST_IGNORE_SPACE
unsetopt HIST_EXPIRE_DUPS_FIRST
setopt SHARE_HISTORY
unsetopt EXTENDED_HISTORY
function powerline_precmd() {
PS1="$(/nix/store/22k5vk2kwlrqwsd8mwmqclkxf7zs2mx4-powerline-go-1.24/bin/powerline-go -error $? -shell zsh -modules ssh,nix-shell
)"
}
function install_powerline_precmd() {
for s in "$\{precmd_functions[@]}"; do
if [ "$s" = "powerline_precmd" ]; then
return
fi
done
precmd_functions+=(powerline_precmd)
}
if [ "$TERM" != "linux" ]; then
install_powerline_precmd
fi
# Aliases
alias -- 'll'='ls -l'
alias -- 'update'='sudo nixos-rebuild switch'
# Named Directory Hashes
source /nix/store/8j392c08hriha2r3j5wkxy8xima3p8ih-zsh-syntax-highlighting-0.8.0/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
ZSH_HIGHLIGHT_HIGHLIGHTERS+=()
{
pkgs,
config,
lib,
...
}: {
programs.powerline-go = {
enable = false;
settings = {
hostname-only-if-ssh = true;
numeric-exit-codes = true;
};
modules = [
"ssh"
# "aws"
# "ssh"
# "direnv"
# "node"
"nix-shell"
# "venv"
#"git"
# "gcp"
];
};
}
{
pkgs,
config,
lib,
...
}: {
programs.zsh = {
enable = true;
enableCompletion = true;
syntaxHighlighting.enable = true;
shellAliases = {
ll = "ls -l";
update = "sudo nixos-rebuild switch";
};
history = {
size = 10000;
path = "${config.xdg.dataHome}/zsh/history";
};
oh-my-zsh = {
enable = true;
plugins = ["git" "thefuck" "github" "mosh" "terraform" "history-substring-search" "command-not-found" "docker" "aws" "azure" "kubectl"];
theme = "robbyrussell";
};
initExtra = ''
'';
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment