.dotfiles/.zshrc

162 lines
4.7 KiB
Bash
Raw Normal View History

2024-05-24 16:07:28 +03:00
# Set up the prompt
autoload -Uz promptinit
#promptinit
#prompt adam1
# Disable ctrl-s to freeze terminal.
stty stop undef
2024-05-24 16:07:28 +03:00
# 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=10000000
SAVEHIST=10000000
2024-05-24 16:07:28 +03:00
HISTFILE=~/.zsh_history
setopt hist_ignore_space
setopt hist_ignore_all_dups
setopt share_history
setopt inc_append_history
2024-05-24 16:07:28 +03:00
# 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
2024-05-24 16:07:28 +03:00
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:*' select-prompt %SScrolling active: current selection at %p%s
zstyle ':completion:*' complete-options true
2024-05-24 16:07:28 +03:00
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 GEMS_HOME="$HOME/.gems"
export PATH="$GEMS_HOME/bin:$PATH"
# Nimble path setup
export NIMBLE_HOME="$HOME/.nimble"
export PATH="$NIMBLE_HOME/bin:$PATH"
# bun
export BUN_HOME="$HOME/.bun"
export PATH="$BUN_HOME/bin:$PATH"
[ -s "$BUN_HOME/_bun" ] && source "/$BUN_HOME/_bun"
2024-05-24 16:07:28 +03:00
# asdf setup
source "$HOME/.asdf/asdf.sh"
fpath=(${ASDF_DIR}/completions $fpath)
# fzf setup
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
# antigen bundles
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'
2024-05-24 16:07:28 +03:00
alias grep='rg'
alias nv='nvim'
alias ff='fastfetch'
2024-05-24 16:07:28 +03:00
# 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 ytwav="yt-dlp -x --audio-format wav"
alias ytmp3="yt-dlp -x --audio-format mp3"
alias ytdv="yt-dlp"
alias docker-clean="docker system prune -a --filter \"until=72h\""
alias flatpak-clean="flatpak uninstall --user --unused"
alias system-clean="docker-clean && flatpak-cean && cargo clean-all"
2024-05-24 16:07:28 +03:00
# git shortcuts
alias gst="git status"
alias gaa="git add --all"
alias gc="git commit -v"
alias gm="git merge"
alias gb="git branch"
alias gco="git checkout"
alias gcb="git checkout -b"
alias gp="git push"
alias gpl="git pull"
alias gd='git diff'
alias gdc="git diff --cached"
alias glg="git log --graph --pretty='%Cred%h%Creset %C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' --date=short"
2024-05-24 16:07:28 +03:00
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
)}
2024-05-24 16:07:28 +03:00
function days_since() {(
now=$(date --date="now" +%s)
input=$(date --date=$1 +%s)
echo $(( ( now - input )/(60*60*24) ))
)}
alias repos="~/.local/bin/repos.sh"
alias reposn="~/.local/bin/reposn.sh"
2024-05-24 16:07:28 +03:00
# 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'
# changing time's format
2024-08-18 00:59:14 +03:00
export TIMEFMT=$'real\t%E\nuser\t%U\nsys\t%S'
2024-05-24 16:07:28 +03:00
# 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)"