1
0
Fork 0
mirror of https://gitlab.com/dwt1/dotfiles.git synced 2023-02-13 20:55:19 -05:00
dwt1--dotfiles/.zshrc

222 lines
6.8 KiB
Bash
Raw Normal View History

2020-02-17 01:07:06 -05:00
# ____ _____
# | _ \_ _| Derek Taylor (DistroTube)
# | | | || | http://www.youtube.com/c/DistroTube
# | |_| || | http://www.gitlab.com/dwt1/
# |____/ |_|
2020-12-05 16:30:52 -05:00
# My zsh config. Not much to see here; just some pretty standard stuff.
2020-02-17 01:07:06 -05:00
2020-12-05 16:30:52 -05:00
### EXPORT
export TERM="xterm-256color" # getting proper colors
export HISTORY_IGNORE="(ls|cd|pwd|exit|sudo reboot|history|cd -|cd ..)"
export EDITOR="emacsclient -t -a ''" # $EDITOR use Emacs in terminal
export VISUAL="emacsclient -c -a emacs" # $VISUAL use Emacs in GUI mode
2020-12-05 16:30:52 -05:00
### SET VI MODE ###
# Comment this line out to enable default emacs-like bindings
bindkey -v
2019-01-15 16:27:01 -05:00
2020-12-05 16:30:52 -05:00
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
2019-01-15 16:27:01 -05:00
2020-12-05 16:30:52 -05:00
### PATH
if [ -d "$HOME/.bin" ] ;
then PATH="$HOME/.bin:$PATH"
2019-03-09 18:52:05 -05:00
fi
2019-01-15 16:27:01 -05:00
2020-12-05 16:30:52 -05:00
if [ -d "$HOME/.local/bin" ] ;
then PATH="$HOME/.local/bin:$PATH"
fi
2019-01-15 16:27:01 -05:00
2020-12-05 16:30:52 -05:00
### CHANGE TITLE OF TERMINALS
case ${TERM} in
xterm*|rxvt*|Eterm*|aterm|kterm|gnome*|alacritty|st|konsole*)
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/\~}\007"'
;;
screen*)
PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/\~}\033\\"'
;;
esac
### ARCHIVE EXTRACTION
# usage: ex <file>
ex ()
{
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1;;
*.7z) 7z x $1 ;;
*.deb) ar x $1 ;;
*.tar.xz) tar xf $1 ;;
*.tar.zst) unzstd $1 ;;
*) echo "'$1' cannot be extracted via ex()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
### OH MY ZSH ###
2019-01-15 16:27:01 -05:00
2020-12-05 16:30:52 -05:00
# Path to your oh-my-zsh installation.
ZSH=$HOME/.oh-my-zsh
2019-01-15 16:27:01 -05:00
2020-12-05 16:30:52 -05:00
# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder
2019-01-15 16:27:01 -05:00
2020-12-05 16:30:52 -05:00
# Which plugins would you like to load?
# Add wisely, as too many plugins slow down shell startup.
# Defning the plugins needs to happen before sourcing oh-my-zsh.
plugins=(command-not-found
emacs
git
history
zsh-interactive-cd)
# Sourcing oh-my-zsh
# Your plugins will not work without this source.
2019-01-15 16:27:01 -05:00
source $ZSH/oh-my-zsh.sh
2020-12-05 16:30:52 -05:00
### ALIASES ###
# root privileges
alias doas="doas --"
# navigation
alias ..='cd ..'
alias ...='cd ../..'
2020-12-05 16:30:52 -05:00
alias .3='cd ../../..'
alias .4='cd ../../../..'
alias .5='cd ../../../../..'
# vim and emacs
alias vim="nvim"
alias em="/usr/bin/emacs -nw"
alias emacs="emacsclient -c -a 'emacs'"
alias doomsync="~/.emacs.d/bin/doom sync"
alias doomdoctor="~/.emacs.d/bin/doom doctor"
alias doomupgrade="~/.emacs.d/bin/doom upgrade"
alias doompurge="~/.emacs.d/bin/doom purge"
# pacman and yay
alias pacsyu='sudo pacman -Syyu' # update only standard pkgs
alias yaysua="yay -Sua --noconfirm" # update only AUR pkgs
alias yaysyu="yay -Syu --noconfirm" # update standard pkgs and AUR pkgs
alias unlock="sudo rm /var/lib/pacman/db.lck" # remove pacman lock
alias cleanup='sudo pacman -Rns $(pacman -Qtdq)' # remove orphaned packages
# get fastest mirrors
alias mirror="sudo reflector -f 30 -l 30 --number 10 --verbose --save /etc/pacman.d/mirrorlist"
alias mirrord="sudo reflector --latest 50 --number 20 --sort delay --save /etc/pacman.d/mirrorlist"
alias mirrors="sudo reflector --latest 50 --number 20 --sort score --save /etc/pacman.d/mirrorlist"
alias mirrora="sudo reflector --latest 50 --number 20 --sort age --save /etc/pacman.d/mirrorlist"
2019-03-09 18:52:05 -05:00
# Changing "ls" to "exa"
alias ls='exa -al --color=always --group-directories-first' # my preferred listing
alias la='exa -a --color=always --group-directories-first' # all files and dirs
alias ll='exa -l --color=always --group-directories-first' # long format
alias lt='exa -aT --color=always --group-directories-first' # tree listing
2020-12-05 16:30:52 -05:00
alias l.='exa -a | egrep "^\."'
# Colorize grep output (good for log files)
alias grep='grep --color=auto'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
# confirm before overwriting something
alias cp="cp -i"
alias mv='mv -i'
alias rm='rm -i'
2019-03-09 18:52:05 -05:00
# adding flags
2019-03-09 18:52:05 -05:00
alias df='df -h' # human-readable sizes
alias free='free -m' # show sizes in MB
alias lynx='lynx -cfg=~/.lynx/lynx.cfg -lss=~/.lynx/lynx.lss -vikeys'
alias vifm='./.config/vifm/scripts/vifmrun'
2020-12-05 16:30:52 -05:00
## get top process eating memory
alias psmem='ps auxf | sort -nr -k 4'
alias psmem10='ps auxf | sort -nr -k 4 | head -10'
## get top process eating cpu ##
alias pscpu='ps auxf | sort -nr -k 3'
alias pscpu10='ps auxf | sort -nr -k 3 | head -10'
# git
alias addup='git add -u'
alias addall='git add .'
alias branch='git branch'
alias checkout='git checkout'
alias clone='git clone'
alias commit='git commit -m'
alias fetch='git fetch'
alias pull='git pull origin'
alias push='git push origin'
alias status='git status'
alias tag='git tag'
alias newtag='git tag -a'
# Merge Xresources
alias merge='xrdb -merge ~/.Xresources'
# get error messages from journalctl
alias jctl="journalctl -p 3 -xb"
# gpg encryption
# verify signature for isos
alias gpg-check="gpg2 --keyserver-options auto-key-retrieve --verify"
# receive the key of a developer
alias gpg-retrieve="gpg2 --keyserver-options auto-key-retrieve --receive-keys"
# youtube-dl
alias yta-aac="youtube-dl --extract-audio --audio-format aac "
alias yta-best="youtube-dl --extract-audio --audio-format best "
alias yta-flac="youtube-dl --extract-audio --audio-format flac "
alias yta-m4a="youtube-dl --extract-audio --audio-format m4a "
alias yta-mp3="youtube-dl --extract-audio --audio-format mp3 "
alias yta-opus="youtube-dl --extract-audio --audio-format opus "
alias yta-vorbis="youtube-dl --extract-audio --audio-format vorbis "
alias yta-wav="youtube-dl --extract-audio --audio-format wav "
alias ytv-best="youtube-dl -f bestvideo+bestaudio "
# switch between shells
alias tobash="sudo chsh $USER -s /bin/bash && echo 'Now log out.'"
alias tozsh="sudo chsh $USER -s /bin/zsh && echo 'Now log out.'"
alias tofish="sudo chsh $USER -s /bin/fish && echo 'Now log out.'"
2019-03-09 18:52:05 -05:00
# bare git repo alias for dotfiles
alias config="/usr/bin/git --git-dir=$HOME/dotfiles --work-tree=$HOME"
2020-02-17 01:07:06 -05:00
# termbin
2019-03-09 18:52:05 -05:00
alias tb="nc termbin.com 9999"
2020-02-17 01:07:06 -05:00
2020-12-05 16:30:52 -05:00
# the terminal rickroll
alias rr='curl -s -L https://raw.githubusercontent.com/keroserene/rickrollrc/master/roll.sh | bash'
2020-02-17 01:07:06 -05:00
2020-12-05 16:30:52 -05:00
### RANDOM COLOR SCRIPT ###
# Get this script from my GitLab: gitlab.com/dwt1/shell-color-scripts
# Or install it from the Arch User Repository: shell-color-scripts
colorscript random
2020-12-05 16:30:52 -05:00
### SOURCING BROOT ###
2020-02-17 01:07:06 -05:00
source /home/dt/.config/broot/launcher/bash/br
2019-03-22 19:45:15 -04:00
### BASH INSULTER ###
if [ -f /etc/bash.command-not-found ]; then
. /etc/bash.command-not-found
fi
2020-12-05 16:30:52 -05:00
### SETTING THE STARSHIP PROMPT ###
eval "$(starship init zsh)"