.dotfiles/.zshrc

128 lines
3.7 KiB
Bash

# Set up the prompt
autoload -Uz promptinit
#promptinit
#prompt adam1
setopt histignorespace histignorealldups sharehistory
# Use emacs keybindings even if our EDITOR is set to vi
bindkey -e
# Keep 1000 lines of history within the shell and save it to ~/.zsh_history:
HISTSIZE=1000
SAVEHIST=1000
HISTFILE=~/.zsh_history
# Use modern completion system
autoload -Uz compinit
compinit
zstyle ':completion:*' auto-description 'specify: %d'
zstyle ':completion:*' completer _expand _complete _correct _approximate
zstyle ':completion:*' format 'Completing %d'
zstyle ':completion:*' group-name ''
zstyle ':completion:*' menu select=2
eval "$(dircolors -b)"
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*' list-colors ''
zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=* l:|=*'
zstyle ':completion:*' menu select=long
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
zstyle ':completion:*' use-compctl false
zstyle ':completion:*' verbose true
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'
# Custom
# sources & path exports
source ~/antigen.zsh
source $HOME/.cargo/env
# Ruby setup & setting ~/.gems as default path for gems
export GEM_HOME="$HOME/.gems"
export PATH="$HOME/.gems/bin:$PATH"
# asdf setup
source "$HOME/.asdf/asdf.sh"
fpath=(${ASDF_DIR}/completions $fpath)
# autoload -Uz compinit && compinit
# fzf setup
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
# antigen bundles
antigen bundle git
antigen bundle pip
antigen bundle command-not-found
antigen bundle zsh-users/zsh-syntax-highlighting
antigen bundle zsh-users/zsh-autosuggestions
antigen apply
# aliases
alias python="python3"
alias pip="pip3"
alias ls='eza --icons'
alias ll='eza -alh -F always --icons'
alias grep='rg'
alias nv='nvim'
alias ff='fastfetch'
# quick helpers
alias uuid='printf "$(uuidgen)" | xclip -selection c'
alias reload="source ~/.zshrc"
alias untar="tar -xvzf"
alias myip="curl http://ipecho.net/plain; echo"
alias diskspace="df -ht ext4"
alias since="days_since"
alias ytd="yt-dlp -x --audio-format wav"
# git shortcuts
alias glo="git log --pretty='format:%C(yellow)%as %C(blue)%cn %C(green)%h %C(reset)%s' --no-merges"
alias glm="git_last_modified"
function git_last_modified() {(
days=${1:-5}
git diff $(git log -1 --before=@{$days.days.ago} --format=%H) --stat
)}
function days_since() {(
now=$(date --date="now" +%s)
input=$(date --date=$1 +%s)
echo $(( ( now - input )/(60*60*24) ))
)}
# private SSH stuff
source ~/.piwrc
# JVM switches
alias use-java8='export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64;export PATH=$JAVA_HOME/bin:$PATH'
alias use-java11='export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64;export PATH=$JAVA_HOME/bin:$PATH'
alias use-java17='export JAVA_HOME=/usr/lib/jvm/java-17-temurin;export PATH=$JAVA_HOME/bin:$PATH'
# changing GREP highlight color
export GREP_COLORS='ms=01;04;32'
# some wayland specific setup
if [[ $XDG_SESSION_TYPE == "wayland" ]]; then
# Forces Firefox to use wayland instead xwayland when the session type is wayland
export MOZ_ENABLE_WAYLAND=1
# Forces OBS to use xwayland since on pure wayland global shortcuts aint working
# Future note, wayland version kinda faster tho so...we just ballin with a WS server for global shortcuts and its fine
# export QT_QPA_PLATFORM=xcb
fi
# change cd for zoxide
eval "$(zoxide init --cmd cd zsh)"
# clears the screen and displays the figlet
clear
figlet -f 'Red Phoenix' Wynd | lolcat
# starts starship
eval "$(starship init zsh)"