Skip to content

Instantly share code, notes, and snippets.

@NovaViper
Last active November 7, 2024 05:59
Show Gist options
  • Save NovaViper/6eeb096936b0c52290632986a3a18d38 to your computer and use it in GitHub Desktop.
Save NovaViper/6eeb096936b0c52290632986a3a18d38 to your computer and use it in GitHub Desktop.
nix_zshrc_oh-my-posh-vi
mattmc3/zfunctions
MichaelAquilina/zsh-auto-notify
ohmyzsh/ohmyzsh path:plugins/tmux
chisui/zsh-nix-shell
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
# Run Tmux on startup
if [ -z "$TMUX" ]; then
/nix/store/1c2qwaqnmz5ad0apnv86jgcpzwfy354m-tmux-3.5a/bin/tmux attach >/dev/null 2>&1 || /nix/store/2p6nbhk9yl2x35gb4hxj0jdidw5d20h7-tmuxp-1.47.0/bin/tmuxp load /home/novaviper/.config/tmuxp/session.yaml >/dev/null 2>&1
exit
fi
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/4z16nad9whssz7m41qqp9s2qhdxmbvp8-zsh-5.9/share/zsh/$ZSH_VERSION/help"
# Use viins keymap as the default.
bindkey -v
AUTO_NOTIFY_EXPIRE_TIME="5000"
KEYTIMEOUT="1"
SPROMPT="Correct $fg[red]%R$reset_color to $fg[green]%r$reset_color? [ny] "
ZSH_AUTOSUGGEST_STRATEGY=("completion")
ZVM_CURSOR_STYLE_ENABLED=false
eval $(/nix/store/sf6y4arqcm100rnnl3dhpg732i774zp6-coreutils-9.5/bin/dircolors -b ~/.dir_colors)
## home-manager/antidote begin :
source /nix/store/n1sgvxn96pabyp8qgi6wgy5rj2a0v2z0-antidote-1.9.7/share/antidote/antidote.zsh
zstyle ':antidote:bundle' use-friendly-names 'yes'
bundlefile=/nix/store/8jn3wjfj8dc4hh61h8fx0jqkhk1sb2as-hm_antidote-files
zstyle ':antidote:bundle' file $bundlefile
staticfile=/tmp/tmp_hm_zsh_plugins.zsh-8jn3wjfj8dc4hh61h8fx0jqkhk1sb2as
zstyle ':antidote:static' file $staticfile
antidote load $bundlefile $staticfile
## home-manager/antidote end
# 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
source /nix/store/gjqjxfq3x2jp0s9rj5gywwbf264fqw2q-zsh-autosuggestions-0.7.0/share/zsh-autosuggestions/zsh-autosuggestions.zsh
ZSH_AUTOSUGGEST_STRATEGY=(history)
# 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/novaviper/.config/zsh/.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
setopt autocd
if [[ $options[zle] = on ]]; then
eval "$(/nix/store/a6hvz25jz626qxnw1m1x0whn68rcwq9q-fzf-0.56.0/bin/fzf --zsh)"
fi
export GPG_TTY=$TTY
eval "$(/nix/store/129dfibbfvgp6gwy3wyvmhlis5m2b56f-zoxide-0.9.6/bin/zoxide init zsh )"
export PYENV_ROOT="/home/novaviper/.local/share/pyenv"
eval "$(/nix/store/8xig94mhzr72qrbjk2dzx7cqslxwk0mv-pyenv-2.4.14/bin/pyenv init - zsh)"
eval "$(/nix/store/408rpimq0jqnnd8wyfy0mpbrf08h4azb-oh-my-posh-23.20.3/bin/oh-my-posh init zsh --config /home/novaviper/.config/oh-my-posh/config.json)"
source /nix/store/arjgapx8y1zywgsjzycg6pw5g7klc9bj-nix-index-with-db-0.1.8/etc/profile.d/command-not-found.sh
if test -n "$KITTY_INSTALLATION_DIR"; then
export KITTY_SHELL_INTEGRATION="no-rc"
autoload -Uz -- "$KITTY_INSTALLATION_DIR"/shell-integration/zsh/kitty-integration
kitty-integration
unfunction kitty-integration
fi
eval "$(/nix/store/vk7m83mq14whwjbhx0gx3934jz4a8gxk-direnv-2.35.0/bin/direnv hook zsh)"
if [[ $options[zle] = on ]]; then
eval "$(/nix/store/nyfkb9if6cmzqlh5wrvlw6dyzbhyglvf-atuin-18.3.0/bin/atuin init zsh )"
fi
_omp_redraw-prompt() {
local precmd
for precmd in $precmd_functions; do
$precmd
done
zle .reset-prompt
}
function _omp_zle-keymap-select() {
if [ "$KEYMAP" = 'vicmd' ]; then
export POSH_VI_MODE="command"
else
export POSH_VI_MODE="insert"
fi
_omp_redraw-prompt
}
_omp_create_widget zle-keymap-select _omp_zle-keymap-select
# reset to default mode at the end of line input reading
function _omp_zle-line-finish() {
export POSH_VI_MODE="insert"
}
_omp_create_widget zle-line-finish _omp_zle-line-finish
# Fix a bug when you C-c in CMD mode, you'd be prompted with CMD mode indicator
# while in fact you would be in INS mode.
# Fixed by catching SIGINT (C-c), set mode to INS and repropagate the SIGINT,
# so if anything else depends on it, we will not break it.
TRAPINT() {
export POSH_VI_MODE="insert"
return $(( 128 + $1 ))
}
# Create shell prompt
if [ $(tput cols) -ge '75' ] || [ $(tput cols) -ge '100' ]; then
/nix/store/21sh71473as4fpyy4n7j3k0j2qw73j4a-toilet-0.3/bin/toilet -f pagga "FOSS AND BEAUTIFUL" --metal
/nix/store/nlbz6xynzd4zxcyp3fdwb5wdgzcg8crb-fastfetch-2.29.0/bin/fastfetch
fi
# Aliases
alias -- atuin-import='export HISTFILE && atuin import auto && unset HISTFILE'
alias -- cava='TERM=xterm-256color cava'
alias -- doom=/home/novaviper/.config/emacs/bin/doom
alias -- doom-config-reload='/home/novaviper/.config/emacs/bin/doom +org tangle /home/novaviper/.config/doom/config.org && /home/novaviper/.config/emacs/bin/doom sync && systemctl --user restart emacs'
alias -- doom-download='/nix/store/j44p1p9kci9rnrr3aj9a8j8rwvfmg75k-git-2.47.0/bin/git clone https://github.com/hlissner/doom-emacs.git /home/novaviper/.config/emacs
'
alias -- doom-org-tangle='/home/novaviper/.config/emacs/bin/doom +org tangle /home/novaviper/.config/doom/config.org'
alias -- eza='eza --icons auto --git '\''--color=always'\'' --group-directories-first --classify'
alias -- fd='fd --hidden'
alias -- fix-gpg-smartcard='pkill gpg-agent && sudo systemctl restart pcscd.service && sudo systemctl restart pcscd.socket && gpg-connect-agent /bye'
alias -- gpg-switch-yubikey='gpg-connect-agent "scd serialno" "learn --force" /bye'
alias -- la='eza -a'
alias -- list-ssh-key='ssh-add -L'
alias -- ll='eza -l'
alias -- lla='eza -la'
alias -- load-pkcs-key='ssh-add -s /nix/store/d5zy6arbw27bfg66qi3072jqwvnkmn0w-opensc-0.25.1/lib/pkcs11/opensc-pkcs11.so'
alias -- load-res-keys='ssh-keygen -K'
alias -- ls=eza
alias -- lt='eza --tree'
alias -- nh='noglob nh'
alias -- nix='noglob nix'
alias -- nixos-rebuild='noglob nixos-rebuild'
alias -- nixos-remote='noglob nixos-remote'
alias -- nom='noglob nom'
alias -- remove-pkcs-key='ssh-add -e /nix/store/d5zy6arbw27bfg66qi3072jqwvnkmn0w-opensc-0.25.1/lib/pkcs11/opensc-pkcs11.so'
alias -- remove-ssh-keys='ssh-add -D'
alias -- start-minecraft-fabric-server='cd ~/Games/MinecraftFabricServer-1.20.1/ && java -Xmx8G -jar ./fabric-server-mc.1.20.1-loader.0.15.7-launcher.1.0.0.jar nogui && cd || cd'
alias -- start-minecraft-server='cd ~/Games/MinecraftServer-1.21.x/ && ./run.sh --nogui && cd || cd'
alias -- wget='wget --hsts-file="/home/novaviper/.local/share/wget-hsts"'
# Named Directory Hashes
source /nix/store/9lrhlxsg2pd93ffz0g9gpcm2sw2k5hg9-zsh-syntax-highlighting-0.8.0/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
ZSH_HIGHLIGHT_HIGHLIGHTERS+=()
ZSH_HIGHLIGHT_STYLES+=(alias 'fg=#50fa7b')
ZSH_HIGHLIGHT_STYLES+=(arg0 'fg=#f8f8f2')
ZSH_HIGHLIGHT_STYLES+=(assign 'fg=#f8f8f2')
ZSH_HIGHLIGHT_STYLES+=(autodirectory 'fg=#ffb86c,italic')
ZSH_HIGHLIGHT_STYLES+=(back-dollar-quoted-argument 'fg=#ff5555')
ZSH_HIGHLIGHT_STYLES+=(back-double-quoted-argument 'fg=#ff5555')
ZSH_HIGHLIGHT_STYLES+=(back-quoted-argument 'fg=#ff79c6')
ZSH_HIGHLIGHT_STYLES+=(back-quoted-argument-delimiter 'fg=#ff5555')
ZSH_HIGHLIGHT_STYLES+=(back-quoted-argument-unclosed 'fg=#ff5555,bold')
ZSH_HIGHLIGHT_STYLES+=(builtin 'fg=#50fa7b')
ZSH_HIGHLIGHT_STYLES+=(command 'fg=#50fa7b')
ZSH_HIGHLIGHT_STYLES+=(command-substitution-delimiter 'fg=#f8f8f2')
ZSH_HIGHLIGHT_STYLES+=(command-substitution-delimiter-quoted 'fg=#f1fa8c')
ZSH_HIGHLIGHT_STYLES+=(command-substitution-delimiter-unquoted 'fg=#f8f8f2')
ZSH_HIGHLIGHT_STYLES+=(command-substitution-quoted 'fg=#f1fa8c')
ZSH_HIGHLIGHT_STYLES+=(commandseparator 'fg=#ff5555')
ZSH_HIGHLIGHT_STYLES+=(comment 'fg=#9ea8c7')
ZSH_HIGHLIGHT_STYLES+=(cursor 'fg=#f8f8f2')
ZSH_HIGHLIGHT_STYLES+=(default 'fg=#f8f8f2')
ZSH_HIGHLIGHT_STYLES+=(dollar-double-quoted-argument 'fg=#f8f8f2')
ZSH_HIGHLIGHT_STYLES+=(dollar-quoted-argument 'fg=#f8f8f2')
ZSH_HIGHLIGHT_STYLES+=(dollar-quoted-argument-unclosed 'fg=#ff5555,bold')
ZSH_HIGHLIGHT_STYLES+=(double-hyphen-option 'fg=#ffb86c')
ZSH_HIGHLIGHT_STYLES+=(double-quoted-argument 'fg=#f1fa8c')
ZSH_HIGHLIGHT_STYLES+=(double-quoted-argument-unclosed 'fg=#ff5555,bold')
ZSH_HIGHLIGHT_STYLES+=(function 'fg=#50fa7b')
ZSH_HIGHLIGHT_STYLES+=(global-alias 'fg=#50fa7b')
ZSH_HIGHLIGHT_STYLES+=(globbing 'fg=#f8f8f2')
ZSH_HIGHLIGHT_STYLES+=(hashed-command 'fg=#50fa7b')
ZSH_HIGHLIGHT_STYLES+=(history-expansion 'fg=#ff79c6')
ZSH_HIGHLIGHT_STYLES+=(named-fd 'fg=#f8f8f2')
ZSH_HIGHLIGHT_STYLES+=(numeric-fd 'fg=#f8f8f2')
ZSH_HIGHLIGHT_STYLES+=(path 'fg=#f8f8f2')
ZSH_HIGHLIGHT_STYLES+=(path_pathseparator 'fg=#ff5555')
ZSH_HIGHLIGHT_STYLES+=(path_prefix 'fg=#f8f8f2')
ZSH_HIGHLIGHT_STYLES+=(path_prefix_pathseparator 'fg=#ff5555')
ZSH_HIGHLIGHT_STYLES+=(precommand 'fg=#50fa7b,italic')
ZSH_HIGHLIGHT_STYLES+=(process-substitution-delimiter 'fg=#f8f8f2')
ZSH_HIGHLIGHT_STYLES+=(rc-quote 'fg=#f1fa8c')
ZSH_HIGHLIGHT_STYLES+=(redirection 'fg=#f8f8f2')
ZSH_HIGHLIGHT_STYLES+=(reserved-word 'fg=#50fa7b')
ZSH_HIGHLIGHT_STYLES+=(single-hyphen-option 'fg=#ffb86c')
ZSH_HIGHLIGHT_STYLES+=(single-quoted-argument 'fg=#f1fa8c')
ZSH_HIGHLIGHT_STYLES+=(single-quoted-argument-unclosed 'fg=#ff5555,bold')
ZSH_HIGHLIGHT_STYLES+=(suffix-alias 'fg=#50fa7b')
ZSH_HIGHLIGHT_STYLES+=(unknown-token 'fg=#ff5555,bold')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment