Initial commit

This commit is contained in:
agryphus 2023-08-02 00:45:22 -04:00
commit 85f5be4658
18 changed files with 663 additions and 0 deletions

24
.config/zsh/.zprofile Normal file
View file

@ -0,0 +1,24 @@
# ZSH Configurations
unsetopt autocd # Change directory just by typing its name (hurts performance)
setopt interactivecomments # Allow comments in interactive mode
setopt magicequalsubst # Enable filename expansion for arguments of the form anything=expression
setopt nonomatch # Hide error message if there is no match for the pattern
setopt notify # Report the status of background jobs immediately
setopt numericglobsort # Sort filenames numerically when it makes sense
setopt promptsubst # Enable command substitution in prompt
setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE
setopt hist_ignore_dups # ignore duplicated commands history list
setopt hist_ignore_space # ignore commands that start with space
setopt hist_verify # show command with history expansion to user before running it
unsetopt ksharrays # 0-indexing arrays breaks highlighting
# Start gpg agent
unset SSH_AGENT_PID
if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
fi
eval $(gpg-agent --daemon)
export PATH=$PATH:~/.local/share/cargo/bin/
export PATH=~/.local/bin:$PATH # Highest precedence to local bin

59
.config/zsh/.zshenv Normal file
View file

@ -0,0 +1,59 @@
#!/bin/zsh
source /opt/miniconda3/etc/profile.d/conda.sh
# Spring cleaning
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_CACHE_HOME="$HOME/.cache"
export XDG_STATE_HOME="$HOME/.local/state"
export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME/npm/config"
export EMACS_INIT_FILE="$XDG_CONFIG_HOME/emacs"
export INPUTRC="$XDG_CONFIG_HOME/readline/inputrc"
export GIT_CONFIG="$XDG_CONFIG_HOME/git/config"
export PASSWORD_STORE_DIR="$XDG_DATA_HOME/password-store"
export CARGO_HOME="$XDG_DATA_HOME/cargo"
export RUSTUP_HOME="$XDG_DATA_HOME/rustup"
export GNUPGHOME="$XDG_DATA_HOME/gnupg"
export NPM_CONFIG_PREFIX="$XDG_CACHE_HOME/npm"
export TEXMFVAR=$XDG_CACHE_HOME/texlive/texmf-var
export VIMINFO="$XDG_STATE_HOME/vim/viminfo"
export TMUX_TMPDIR="$XDG_RUNTIME_DIR"
export BROWSER='thorium-browser'
export EDITOR='nvim'
export SUDO_PROMPT="
⢀⡔⣻⠁ ⢀⣀⣀⡀
⢀⣾⠳⢶⣦⠤⣀ ⣾⢀⡇⡴⠋⣀⠴⣊⣩⣤⠶⠞⢹⣄
⢸ ⢠⠈⠙⠢⣙⠲⢤⠤⠤ ⠒⠳⡄⣿⢀⠾⠓⢋⠅⠛⠉⠉⠝ ⠼
⢸ ⢰⡀⠁ ⠈⠑⠦⡀ ⠈⠺⢿⣂ ⠉⠐⠲⡤⣄⢉⠝⢸
⢸ ⢀⡹⠆ ⡠⠃ ⠉⠙⠲⣄ ⠙⣷⡄⢸
⢸⡀⠙⠂⢠ ⡠⠊ ⢠ ⠘⠄ ⠑⢦⣔ ⢡⡸
⢀⣧ ⢀⡧⣴⠯⡀ ⡎ ⢸⡠⠔⠈⠁⠙⡗⡤⣷⡀
⡜⠈⠚⠁⣬⠓⠒⢼⠅ ⣠⡇ ⣧ ⡀⢹ ⠸⡄
⡸ ⠘⢸⢀⠐⢃ ⡰⠋⡇ ⢠ ⡿⣆ ⣧⡈⡇⠆⢻
⢰⠃ ⢀⡇⠼⠉ ⢸⡤⠤⣶⡖⠒⠺⢄⡀⢀⠎⡆⣸⣥⠬⠧⢴⣿⠉⠁⠸⡀⣇
⠇ ⢸ ⣰⠋ ⢸⣿⣿ ⠙⢧⡴⢹⣿⣿ ⠈⣆ ⢧⢹⡄
⣸ ⢠ ⢸⡀ ⢻⡀ ⢸⣿⣿ ⡼⣇⢸⣿⣿ ⢀⠏ ⢸ ⠇
⠓⠈⢃ ⡇ ⣗⠦⣀⣿⡇ ⣀⠤⠊ ⠈⠺⢿⣃⣀⠤⠔⢸ ⣼⠑⢼
⢸⡀⣀⣾⣷⡀ ⢸⣯⣦⡀ ⢇⣀⣀⠐⠦⣀⠘ ⢀⣰⣿⣄ ⡟
⠛⠁⣿⣿⣧ ⣿⣿⣿⣿⣦⣀ ⣀⣠⣴⣿⣿⡿⠈⠢⣼⡇
⠈⠁⠈⠻⠈⢻⡿⠉⣿⠿⠛⡇⠒⠒⢲⠺⢿⣿⣿⠉⠻⡿⠁ ⠈⠁
⢀⠤⠒⠦⡀ ⢀⠞⠉⠆ ⠉⠉⠉ ⡝⣍
⡎ ⡇ ⡰⠋ ⢸ ⢡⠈⢦
⡇ ⠸⠁ ⢀⠜⠁ ⡸ ⠘⡄⠈⢳⡀
⡇ ⢠ ⠠⣯⣀ ⡰⡇ ⢣ ⢀⡦⠤⢄⡀
⢱⡀ ⠈⠳⢤⣠⠖⠋⠛⠛⢷⣄⢠⣷⠁ ⠘⡾⢳⠃ ⠘⢇
⠙⢦⡀ ⢠⠁ ⠙⣿⣏⣀ ⣀⣴⣧⡃ ⣸
⠈⠉⢺⣄ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣗⣤⣀⣠⡾⠃
⠣⢅⡤⣀⣀⣠⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⠉⠉⠉
⠉⠉⠉⠁ ⠉⣿⣿⣿⣿⣿⡿⠻⣿⣿⣿⣿⠛⠉
⣸⣿⣿⣿ ⣿⣿⣿⡿
⣴⣿⣿⣿⣟ ⢠⣿⣿⣿⣿⣧
⢰⣿⣿⣿⣿⣿ ⢸⣿⣿⣿⣿⣿
⢸⣿⣿⣿⣿⡏ ⢸⣿⣿⣿⣿⣿⡀
⢠⣿⣿⣿⣿⣿ ⢺⣿⣿⣿⣿⣿⣿⣷
⣿⣿⣿⣿⣿⣿ ⠈⠉⠻⣿⣿⣿⠟
⠘⢿⣿⣿⣿⠏ Dori dori"

169
.config/zsh/.zshrc Executable file
View file

@ -0,0 +1,169 @@
alias ll='ls -l'
alias la='ls -A'
alias l='ls -CF'
alias python='python3'
alias clip=/mnt/c/Windows/System32/clip.exe
alias startx="export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0.0 && \
export LD_LIBRARY_PATH=/usr/lib/wsl/lib && \
export LIBGL_ALWAYS_SOFTWARE=1 && \
. ~/.config/X11/xinitrc"
alias vcxsrv='/mnt/c/Program\ Files/VcXsrv/vcxsrv.exe :0 -clipboard -wgl -keyhook'
alias wget='wget --hsts-file="$XDG_CACHE_HOME/wget-hsts"'
alias config='git --git-dir $HOME/repos/archrice/ --work-tree=$HOME'
# Print out all colors
alias colors='for i in {0..255}; do print -Pn "%K{$i} %k%F{$i}${(l:3::0:)i}%f " ${${(M)$((i%6)):#3}:+$"\n"}; done'
# Colors
alias ls='LC_COLLATE=C ls --color=auto --group-directories-first -hN -A'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias diff='diff --color=auto'
alias ip='ip --color=auto'
# Enable completion features
autoload -Uz compinit
compinit -d ~/.cache/zcompdump
zstyle ':completion:*:*:*:*:*' menu select
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' # case insensitive tab completion
# Remove green background of simlinks
LS_COLORS+=':ow=01;33'
# Don't consider certain characters part of the word
WORDCHARS=${WORDCHARS//\/}
# History configurations
export HISTFILE=~/.local/share/history
HISTSIZE=1000
SAVEHIST=2000
alias history="history 0" # force zsh to show the complete history
export GPG_TTY=$(tty)
# Building the prompt
C_PROMPT="%F{cyan}"
C_GIT="%F{green}"
C_CONDA="%F{009}"
C_DIR="%F{yellow}"
C_RESET="%F{reset}"
RPROMPT=$'%(?.. %? %F{red}%B%b%F{reset})'
err="$?"
curr_time="%*"
dir='%(4~|.../%3~|%~)' # 3 deep, or truncation
function precmd {
PROMPT="${C_PROMPT}[$USERNAME@$(sed 1q /etc/hostname)${C_DIR}:${dir}${C_PROMPT}]"
extra="$(parse_conda)$(parse_git)"
if [ ! -z "$extra" ]; then
PROMPT+=$'\n'"$extra"
fi
PROMPT+="${C_RESET}$ "
}
function parse_git() {
if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
echo ""
return
fi
# Get branch
local branch
branch="$(git symbolic-ref HEAD 2> /dev/null)"
branch="${branch#refs/heads/}"
# If we're in detached HEAD the above doesn't work, so use reflog instead
[[ -z $branch ]] && branch="$(git reflog HEAD | grep 'checkout:' | head -n1 | grep -oE '[^ ]+$')"
# Check dirty status
[[ -z $(git status --porcelain 2> /dev/null) ]] \
&& dirty="%F{green}✓${C_RESET}" \
|| dirty="%F{red}✗${C_RESET}"
# Get our branch or ref, depending if we're in detached HEAD or not.
ref=$(git symbolic-ref HEAD 2>/dev/null) \
&& { ref=${ref#refs/heads/} ; branch="$ref" ; } \
|| ref=$(git reflog HEAD | awk 'NR==1 && /checkout:/ { print $NF }')
# Checking number of comits ahead or behind
upstream_ref=$(git for-each-ref --format='%(refname:short)|%(upstream:short)' refs/heads \
| grep "^$branch|" \
| cut -d'|' -f2)
if [[ "$upstream_ref" ]]; then
updown=( $(git rev-list --count --left-right "$upstream_ref"...HEAD) )
[[ ${updown[1]} -gt 0 ]] && tracking+="%F{red}-${updown[1]}${C_RESET}:" # Behind
[[ ${updown[2]} -gt 0 ]] && tracking+="%F{magenta}+${updown[2]}${C_RESET}:" # Ahead
fi
# Put together our prompt string
git_prompt+="${C_GIT}["
git_prompt+="${ref}:${C_RESET}"
git_prompt+="${tracking}"
git_prompt+="${dirty}"
git_prompt+="${C_GIT}]${C_RESET}"
echo "$git_prompt"
}
function parse_conda() {
env=$CONDA_DEFAULT_ENV
if [ -z "$env" ] || [ "$env" = "base" ]; then
echo ""
return
fi
echo "${C_CONDA}[$env]"
}
# Config for zsh-syntax-highlighting
LIGHT_GREY=242
. ~/.config/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern)
ZSH_HIGHLIGHT_STYLES[arg0]=fg=yello
ZSH_HIGHLIGHT_STYLES[reserved-word]=fg=cyan,bold
ZSH_HIGHLIGHT_STYLES[suffix-alias]=fg=green,underline
ZSH_HIGHLIGHT_STYLES[single-hyphen-option]=fg=$LIGHT_GREY
ZSH_HIGHLIGHT_STYLES[double-hyphen-option]=fg=$LIGHT_GREY
ZSH_HIGHLIGHT_STYLES[global-alias]=fg=magenta
ZSH_HIGHLIGHT_STYLES[precommand]=fg=cyan
ZSH_HIGHLIGHT_STYLES[commandseparator]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[globbing]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[history-expansion]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[command-substitution-delimiter]=fg=magenta
ZSH_HIGHLIGHT_STYLES[process-substitution-delimiter]=fg=magenta
ZSH_HIGHLIGHT_STYLES[back-quoted-argument-delimiter]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[single-quoted-argument]=fg=yellow
ZSH_HIGHLIGHT_STYLES[double-quoted-argument]=fg=yellow
ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]=fg=yellow
ZSH_HIGHLIGHT_STYLES[rc-quote]=fg=magenta
ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]=fg=magenta
ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]=fg=magenta
ZSH_HIGHLIGHT_STYLES[back-dollar-quoted-argument]=fg=magenta
ZSH_HIGHLIGHT_STYLES[redirection]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[comment]=fg=black,bold
ZSH_HIGHLIGHT_STYLES[bracket-error]=fg=red,bold
ZSH_HIGHLIGHT_STYLES[bracket-level-1]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[bracket-level-2]=fg=green,bold
ZSH_HIGHLIGHT_STYLES[bracket-level-3]=fg=magenta,bold
ZSH_HIGHLIGHT_STYLES[bracket-level-4]=fg=yellow,bold
ZSH_HIGHLIGHT_STYLES[bracket-level-5]=fg=cyan,bold
ZSH_HIGHLIGHT_STYLES[cursor-matchingbracket]=standout
# Unset styles
ZSH_HIGHLIGHT_STYLES[path]=none
ZSH_HIGHLIGHT_STYLES[assign]=none
ZSH_HIGHLIGHT_STYLES[default]=none
ZSH_HIGHLIGHT_STYLES[named-fd]=none
ZSH_HIGHLIGHT_STYLES[numeric-fd]=none
ZSH_HIGHLIGHT_STYLES[unknown-token]=none
ZSH_HIGHLIGHT_STYLES[back-quoted-argument]=none
ZSH_HIGHLIGHT_STYLES[command-substitution]=none
ZSH_HIGHLIGHT_STYLES[process-substitution]=none
ZSH_HIGHLIGHT_STYLES[path_pathseparator]=
ZSH_HIGHLIGHT_STYLES[path_prefix_pathseparator]=
source ~/.config/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.plugin.zsh