1
0
Fork 0
dotfiles/.zshrc

106 lines
2.8 KiB
Bash

# Autocompletion
autoload -Uz compinit promptinit vcs_info
compinit
zmodload zsh/complist
promptinit
# Include hidden files
_comp_options+=(globdots)
setopt prompt_subst
setopt extendedglob
setopt COMPLETE_ALIASES
setopt autocd
setopt CORRECT
setopt CORRECT_ALL
CORRECT_IGNORE="[_|.]*"
# Autocompletion cache
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path "$XDG_CACHE_HOME/zsh"
# Double TAB arrow-key driven selection
zstyle ':completion:*' menu select
# Ignore completion functions for unavailable commands
zstyle ':completion:*:functions' ignored-patterns '_*'
# Remove trailing directory slash
zstyle ':completion:*' squeeze-slashes true
# Enable (only) git detection
zstyle ':vcs_info:*' enable git
# History
setopt hist_ignore_all_dups
HISTFILE="$HOME/.zsh/history"
HISTSIZE=100000000
SAVEHIST=$HISTSIZE
# Functions
git_branch() {
git symbolic-ref --short HEAD 2> /dev/null
}
# Prompt theme
precmd() { print -rP "%F{#ebcb8b}%n%f%F{#8fbcbb}@%F{#81a1c1}%m%f %F{#d08770}%B%~%b%f %F{#a3be8c}$(git_branch)%f" }
PROMPT=' > '
eval $(dircolors ~/.dir_colors)
zstyle ':completion:*:default' list-colors "${(s.:.)LS_COLORS}"
# Bindings
bindkey -e
bindkey "^[[A" history-beginning-search-backward
bindkey "^[[B" history-beginning-search-forward
# Aliases
alias ls='ls -A --color=auto'
alias l='ls -Ahl --color=auto'
alias grep='grep --color=auto'
alias less='less -i'
alias vim=nvim
alias vi=nvim
alias cat=bat
alias cx=clear
alias mpva='mpv --no-video'
alias gpgsim='gpg -c --no-symkey-cache --cipher-algo AES256 --digest-algo SHA512'
alias updm='sudo reflector --ipv4 --latest 40 --sort rate --save /etc/pacman.d/mirrorlist'
alias clpkc='paccache -rk0 && paccache -ruk0 && pacman -Qtdq | sudo pacman -Rns -'
alias noscreenblanking='xset s off -dpms'
alias ytlistf='yt-dlp --list-formats'
alias gc='gcc -lm -O2 -g -Wall -Wextra'
alias g+='g++ -lm -O2 -g -Wall -Wextra'
alias redscreen='redshift -P -O 4000'
alias updchroot='arch-nspawn $CHROOT/root pacman -Syu'
alias chrooted='CHROOT=$HOME/chroot'
alias axelf='axel -4kN'
# git
alias gits='git status'
# just in case
alias cp='cp -i'
alias mv='mv -i'
alias rm='rm -i'
# tar stuff
alias untar='tar -xvf'
alias tarxzu="tar --owner=root --group=root --use-compress-program='xz -9eT0' -cvf"
alias tarlzu='tarlz --anonymous -9vcf'
# archive
alias 7zu='7z a -t7z -m0=lzma2 -mfb=273 -md=1536m -mx=9 -ms=on'
# source list
#alias meson-list-src='tree -L 100000 -ifF --noreport $1 | rg -v /$ | sed s/$/,/g'
# export
export _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=gasp'
#export GEM_HOME="$(ruby -e 'puts Gem.user_dir')"
#export PATH="$PATH:$GEM_HOME/bin:$HOME/bin"
export LESSHISTFILE="$XDG_CACHE_HOME/less/history"
# Plugins
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
source /usr/share/zsh/plugins/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh