# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc. # Initialization code that may require console input (password prompts, [y/n] # confirmations, etc.) must go above this block; everything else may go below. if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" fi # Set the directory we want to install Zinit and plugins ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git" # Download Zinit, if it's not installed if [ ! -d "$ZINIT_HOME" ]; then mkdir -p "$(dirname $ZINIT_HOME)" git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME" fi # Source Zinit source "$ZINIT_HOME/zinit.zsh" OS_ID=$(grep -ioP '^ID=\K.+' /etc/os-release) # Add in Powerlevel10k zinit ice depth=1; zinit light romkatv/powerlevel10k # Add in plugins zinit light zsh-users/zsh-syntax-highlighting zinit light zsh-users/zsh-completions zinit light zsh-users/zsh-autosuggestions zinit snippet OMZP::git zinit snippet OMZP::sudo case "$OS_ID" in "debian") zinit snippet OMZP::debian ;; "arch") zinit snippet OMZP::archlinux ;; "fedora") zinit snippet OMZP::dnf ;; esac # Keybindings bindkey -e bindkey '^[[A' history-search-backward bindkey '^[[B' history-search-forward bindkey '^p' history-search-backward bindkey '^n' history-search-forward # History HISTSIZE=5000 HISTFILE="$HOME/.local/state/zsh/history" SAVEHIST=$HISTSIZE HISTDUP=erase setopt appendhistory setopt sharehistory setopt hist_ignore_space setopt hist_ignore_all_dups setopt hist_save_no_dups setopt hist_ignore_dups setopt hist_find_no_dups export LS_COLORS="rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=01;37;41:su=37;41:sg=30;43:ca=00:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.avif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=01;36:*.au=01;36:*.flac=01;36:*.m4a=01;36:*.mid=01;36:*.midi=01;36:*.mka=01;36:*.mp3=01;36:*.mpc=01;36:*.ogg=01;36:*.ra=01;36:*.wav=01;36:*.oga=01;36:*.opus=01;36:*.spx=01;36:*.xspf=01;36:*~=00;90:*#=00;90:*.bak=00;90:*.crdownload=00;90:*.dpkg-dist=00;90:*.dpkg-new=00;90:*.dpkg-old=00;90:*.dpkg-tmp=00;90:*.old=00;90:*.orig=00;90:*.part=00;90:*.rej=00;90:*.rpmnew=00;90:*.rpmorig=00;90:*.rpmsave=00;90:*.swp=00;90:*.tmp=00;90:*.ucf-dist=00;90:*.ucf-new=00;90:*.ucf-old=00;90:" # XDG environment variables export XDG_CONFIG_HOME="$HOME/.config" export XDG_CACHE_HOME="$HOME/.cache" export XDG_DATA_HOME="$HOME/.local/share" export XDG_STATE_HOME="$HOME/.local/state" export DOCKER_CONFIG="$XDG_CONFIG_HOME/docker" export ANSIBLE_HOME="$XDG_CONFIG_HOME/ansible" export ANSIBLE_CONFIG="$XDG_CONFIG_HOME/ansible.cfg" export ANSIBLE_GALAXY_CACHE_DIR="$XDG_CACHE_HOME/ansible/galaxy_cache" export PYTHON_HISTORY="$XDG_STATE_HOME/python/history" export PYTHONPYCACHEPREFIX="$XDG_CACHE_HOME/python" export PYTHONUSERBASE="$XDG_DATA_HOME/python" export RUSTUP_HOME="$XDG_DATA_HOME/rustup" export GTK2_RC_FILES="$XDG_CONFIG_HOME/gtk-2.0/gtkrc" export LESSHISTFILE="$XDG_STATE_HOME/less/history" # Completion styling zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}' zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}" zstyle ':completion:*' menu select # Completion files: Use XDG dirs [ -d "$XDG_CACHE_HOME"/zsh ] || mkdir -p "$XDG_CACHE_HOME"/zsh zstyle ':completion:*' cache-path "$XDG_CACHE_HOME"/zsh/zcompcache autoload -Uz compinit; compinit -d "$XDG_CACHE_HOME"/zsh/zcompdump-$ZSH_VERSION zinit cdreplay -q # Aliases alias ls='ls --color' alias vim='nvim' alias c='clear' # Shell integrations if command -v fzf &> /dev/null; then source <(fzf --zsh) fi if command -v zoxide &> /dev/null; then source <(zoxide init --cmd cd zsh) fi # To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh # if SSH agent is not loaded, but a socket file exists, inlcude running ssh-agent if ! test -v SSH_AUTH_SOCK && test -e "$XDG_RUNTIME_DIR/ssh-agent.socket"; then export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket" fi export EDITOR="$(which nvim)" export PATH="$HOME/.config/emacs/bin:$HOME/.local/bin:$HOME/.local/share/gem/ruby/3.0.0/bin:$PATH" if test -d "$XDG_DATA_HOME/nvm"; then export NVM_DIR="$XDG_DATA_HOME/nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion fi