!.zshenv
!.zprofile
!include/
+!completions/
-# terminfo
-[[ $TERM = "tmux-256color" ]] && export TERM=screen-256color
-
# xdg variables
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_DATA_HOME="$HOME/.local/share"
# shell variables
export SHELL="/bin/zsh"
-export ZDOTDIR="$HOME/.config/zsh"
export ZSH="$ZDOTDIR"
-export ZSH_CUSTOM="$ZSH/custom"
+export ZSHEXTRA="$ZDOTDIR/extra"
+export ZSHINCLUDE="$ZDOTDIR/include"
+export ZSHCOMPLETION="$ZSH/completions"
+export ZSHHISTORY="$ZSH/history"
export ZSH_COMPDUMP="$ZSH/cache/.zcompdump-$HOST"
# my folders
export SCRIPTS="$REPOS/script"
export DOWNLOADS="$HOME/downloads"
export PACKAGES="$HOME/.packages"
+export CONFIG="$XDG_CONFIG_HOME"
# system variables
export LANG=en_US.UTF-8
# path variables
-export PATH="$PATH:$HOME/.local/bin:."
-export PATH="$PATH:$REPOS/script:$REPOS/ruby"
+export PATH="$PATH:$HOME/.local/bin:$REPOS/script:$REPOS/ruby:."
export CDPATH=".:$HOME:$HOME/$REPOS:$HOME/$XDG_CONFIG_HOME:/"
# language variables
export EMAIL='huck@huck.website'
# config paths
+export GTK_2_RC_FILES="$XDG_CONFIG_HOME/gtk-2.0/gtkrc"
export LESSHISTFILE="$XDG_STATE_HOME/less/history"
export TERMINFO="$XDG_DATA_HOME/terminfo"
+export TERMINFO_DIRS="$XDG_DATA_HOME/terminfo:/usr/share/terminfo"
export INPUTRC="$XDG_CONFIG_HOME/readline/inputrc"
+export CUDA_CACHE_PATH="$XDG_CACHE_HOME/nv"
# zoxide
export _ZO_ECHO='1'
#shellcheck disable=all
-# sourcing -------------------------------------------------
-. $ZSH/.zshenv
-ZSHEXTRA=$ZSH/extra
-ZSHINCLUDE=$ZSH/include
-[[ ! -d $ZSH ]] && mkdir $ZSH/{,cache,extra,include}
-# source files from include dir
-for file in $ZSHINCLUDE/*; do . ${file}; done
-
-# start programs
-[[ -f $XDG_CONFIG_HOME/.dircolors ]] && eval $(dircolors -b $XDG_CONFIG_HOME/.dircolors)
-[[ $(which zoxide) ]] && eval "$(zoxide init zsh --cmd z)"
+# setup ~/.config/zsh
+. $ZDOTDIR/.zshenv
+[[ ! -d $ZSH ]] && mkdir -p $ZSH/cache $ZSHINCLUDE $ZSHCOMPLETION $ZSHEXTRA $ZSHHISTORY
-# options ------------------------------------------------------------
+# options
ENABLE_CORRECTION="true"
COMPLETION_WAITING_DOTS="true"
HISTFILE=$ZSH/history/zsh-history
setopt null_glob glob glob_dots glob_star_short bang_hist
unsetopt flow_control
-# completion ---------------------------------------------------------
-zstyle ':completion:*' auto-description '%d'
-zstyle ':completion:*' completer _expand _complete _ignored _correct _approximate
-zstyle ':completion:*' completions 1
-zstyle ':completion:*' expand prefix suffix
-zstyle ':completion:*' file-sort access
-zstyle ':completion:*' format '%d'
-zstyle ':completion:*' glob 1
-zstyle ':completion:*' group-name ''
-zstyle ':completion:*' ignore-parents parent pwd
-zstyle ':completion:*' insert-unambiguous true
-zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
-zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
-zstyle ':completion:*' matcher-list '' 'm:{[:lower:]}={[:upper:]}' 'r:|[._-,]=** r:|=**' 'l:|=* r:|=*'
-zstyle ':completion:*' max-errors 3
-zstyle ':completion:*' menu select=long interactive
-zstyle ':completion:*' original true
-zstyle ':completion:*' prompt '%e'
-zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
-zstyle ':completion:*' squeeze-slashes true
-zstyle ':completion:*' substitute 1
-zstyle ':completion:*' verbose true
+# completion
+fpath=($ZSHCOMPLETION $fpath)
+[[ -f $ZSHCOMPLETION/completions.zsh ]] && source $ZSHCOMPLETION/completions.zsh
+
+# source files from include dir
+for file in $ZSHINCLUDE/*; do . ${file}; done
-autoload -Uz compinit
-for dump in ~/.zcompdump(N.mh+24); do
- compinit
-done
-compinit -C
-zshcache_time="$(date +%s%N)"
+# start programs
+[[ -f $XDG_CONFIG_HOME/.dircolors ]] && eval $(dircolors -b $XDG_CONFIG_HOME/.dircolors)
+[[ $(which zoxide) ]] && eval "$(zoxide init zsh --cmd z)"
-# zle plugins -------------------------------------------------------
+# zle plugins
autoload -Uz chpwd_recent_dirs cdr add-zsh-hook
+autoload -Uz run-help
add-zsh-hook chpwd chpwd_recent_dirs
chpwd() { ls -Ah }
-autoload -Uz run-help
-
-# keybindings -------------------------------------------------------
+# keybindings
bindkey "\e[1~" beginning-of-line
bindkey "\e[4~" end-of-line
bindkey "\e[5~" beginning-of-history
bindkey "\e[3~" delete-char
bindkey "\e[2~" quoted-insert
-# custom prompt -----------------------------------------------------
+# custom prompt
if [[ -n $SSH_CONNECTION ]]; then
PROMPT='%(?..%B%F{red}x)
-%B%F{yellow}%n%b%f@%B%F{blue}%M%b%f -> %F{green}%d %F{red}[SSH] %B%F{magenta}[gentoo]%b%f $(git_prompt_enhanced_status)
+%B%F{yellow}%n%b%f@%B%F{red}%m%b%f: %F{blue}%~ %F{red}[SSH] %F{magenta}[gentoo] %f$(git_prompt_enhanced_status)
%B%F{green}%(!.#.$) %f%b> '
-RPROMPT='[%!]'
+RPROMPT='%f[%!]'
else
PROMPT='%(?..%B%F{red}x)
%B%F{green}%n%b%f@%B%F{red}%m%b%f: %F{blue}%~ %f$(git_prompt_enhanced_status)
--- /dev/null
+LIST_PACKED=true
+GLOB_COMPLETE=true
+
+zstyle ':completion:*' completer _expand _extensions _complete _approximate
+zstyle ':completion:*' completions true
+zstyle ':completion:*' expand prefix suffix
+zstyle ':completion:*' insert-unambiguous true
+zstyle ':completion:*' max-errors 3
+
+zstyle ':completion:*' file-sort time follow
+zstyle ':completion:*' file-list all
+
+zstyle ':completion:*' path-completion true
+zstyle ':completion:*' glob true
+zstyle ':completion:*' group-name ''
+zstyle ':completion:*' ignore-parents parent pwd
+zstyle ':completion:*' substitute true
+zstyle ':completion:*' squeeze-slashes true
+
+zstyle ':completion:*' menu select=long search
+zstyle ':completion:*' original true
+zstyle ':completion:*' verbose true
+zstyle ':completion:*' prompt '%e'
+zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
+zstyle ':completion:*' matcher-list '' 'm:{[:lower:]}={[:upper:]}' 'r:|[._-,]=** r:|=**' 'l:|=* r:|=*'
+
+zstyle ':completion:*' gain-privileges true
+
+zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
+zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
+
+zstyle ':completion:*' auto-description '%d'
+zstyle ':completion:*:*:*:*:descriptions' format '%F{green}-- %d --%f'
+zstyle ':completion:*:corrections' format '%F{yellow}!- %d -!%f'
+zstyle ':completion:*:warnings' format '%F{red}no matches%f'
+zstyle ':completion:*:messages' format '%F{blue}== %d ==%f'
+
+autoload -Uz compinit
+for dump in ~/.zcompdump(N.mh+24); do
+ compinit
+done
+compinit -C
+zshcache_time="$(date +%s%N)"
-#shell aliases
alias cp='cp -vr'
alias rm='rm -v'
alias mv='mv -v'
alias mkdir='mkdir -pv'
alias mount='mount --mkdir'
alias lsblk='lsblk -f'
+
alias reload='source $ZSH/.zshrc'
alias quit='disown -a && exit'
alias :q='exit'
-# vim aliases
alias v='nvim'
alias vsesh='nvim -S'
alias vdiff='nvim -d'
-# sudo aliases
alias sv='sudoedit'
-alias sudo='sudo '
+alias sudo="sudo "
-# convinience aliases
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
+
alias h='history 0'
alias j='jobs -l'
alias c='clear'
-alias zc='cd; clear'
+alias zc='cd;clear'
+
+alias cd='z '
+
alias dust='dust -rb'
alias xz='xz -v -T0 -9 -M64G'
alias make='make CFLAGS="-march=sandybridge -O2 -pipe" -j48 -l30'
-# ls aliases
alias ls='lsd'
alias l='ls'
-alias la='l -Ah'
-alias ll='la -l'
-alias lt='l --tree'
+alias ll='ls -lAh'
+alias la='ls -Ah'
+alias lt='ls --tree'
-# color aliases
alias ip='ip --color=auto'
alias grep='grep --color=auto'
-alias fgrep='fgrep --color=auto'
-alias egrep='egrep --color=auto'
-# tmux aliases
-alias tmux='tmux'
alias tattach='tmux attach-session -t'
-# docker aliases
alias d='docker'
alias dr='docker run -d --rm'
alias dc='docker compose up -d --remove-orphans'
alias drs='docker restart'
alias de='docker exec -it'
alias dlog='docker logs --timestamps --follow -n20'
+# config aliases
+alias wget='wget --hsts-file="$XDG_DATA_HOME/wget-hsts"'
#!/bin/bash
-# grep through history
-hg() { history 0 | grep "$1"; }
-
# easy find files
-f() { find . | grep "$1"; }
-
-cd() { z $1; ls }
+f() {
+ find . | grep "$1";
+}
# smart remove
rem() {
-if [[ -d $ZSHEXTRA/zsh-autosuggestions ]]; then
- source $ZSHEXTRA/zsh-autosuggestions/zsh-autosuggestions.zsh
- ZSH_AUTOSUGGEST_STRATEGY=(history completion)
- set ZSH_AUTOSUGGEST_USE_ASYNC
+# fish like autosuggestions
+if [[ ! -d $ZSHEXTRA/zsh-autosuggestions ]]; then
+ cd $ZSHEXTRA
+ git clone 'https://github.com/zsh-users/zsh-autosuggestions' "$ZSHEXTRA/zsh-autosuggestions"
fi
+source "$ZSHEXTRA/zsh-autosuggestions/zsh-autosuggestions.zsh"
+ZSH_AUTOSUGGEST_STRATEGY=(history completion)
+set ZSH_AUTOSUGGEST_USE_ASYNC
-if [[ -d $ZSHEXTRA/zsh-fast-syntax-highlighting ]]; then
- source $ZSHEXTRA/zsh-fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh
- fast-theme -q $ZSH/extra/zsh-fast-syntax-highlighting/themes/custom.ini
+# syntax highlighing
+if [[ ! -d $ZSHEXTRA/zsh-fast-syntax-highlighting ]]; then
+ cd $ZSHEXTRA
+ git clone 'https://github.com/zdharma-continuum/fast-syntax-highlighting' "$ZSHEXTRA/zsh-fast-syntax-highlighting"
fi
+source $ZSHEXTRA/zsh-fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh
+fast-theme -q $ZSH/extra/zsh-fast-syntax-highlighting/themes/custom.ini
-if [[ -d $ZSHEXTRA/zsh-history-substring-search ]]; then
- source $ZSHEXTRA/zsh-history-substring-search/zsh-history-substring-search.zsh
- bindkey '^[[A' history-substring-search-up
- bindkey '^[[B' history-substring-search-down
+# up arrow history search of partial commands
+if [[ ! -d $ZSHEXTRA/zsh-history-substring-search ]]; then
+ cd $ZSHEXTRA
+ git clone 'https://github.com/zsh-users/zsh-history-substring-search'
fi
+source $ZSHEXTRA/zsh-history-substring-search/zsh-history-substring-search.zsh "$ZSHEXTRA/zsh-history-substring-search"
+bindkey '^[[A' history-substring-search-up
+bindkey '^[[B' history-substring-search-down