dotfiles/files/zshrc

127 lines
2.6 KiB
Bash
Raw Normal View History

# Path to oh-my-zsh installation.
export ZSH=/usr/share/oh-my-zsh/
# Plugins
plugins=(
2023-07-28 14:21:08 +01:00
aliases
archlinux
common-aliases
extract
2023-07-28 14:21:08 +01:00
gh
heroku
2023-07-28 14:21:08 +01:00
pip
poetry
python
vscode
)
export COMPLETION_WAITING_DOTS="true"
2023-07-28 14:06:57 +01:00
DISABLE_AUTO_UPDATE=true
2023-02-17 22:57:45 +00:00
source /usr/share/zsh/plugins/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh
export fpath=(/usr/share/zsh/site-functions $fpath)
autoload -Uz colors && colors
local ret_status="%(?:%{$fg_bold[green]%}λ :%{$fg_bold[red]%}λ )"
export PROMPT="${ret_status} %{$fg_bold[green]%}%n@%m%{$reset_color%}:%{$fg_bold[blue]%}%~%{$reset_color%}$ "
# Enable oh-my-zsh
source $ZSH/oh-my-zsh.sh
2023-02-19 18:44:24 +00:00
eval "$(direnv hook zsh)"
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
# Set environment variables
export DOTFILES=${HOME}/.dotfiles
export TIMEFMT=$'\nreal\t%E\nuser\t%U\nsys\t%S'
export HISTCONTROL=ignoreboth
export BROWSER=$(which firefox)
export EDITOR=$(which nvim)
# bash aliases
alias c="clear"
alias e="exit"
alias no="yes n"
alias open="mimeopen"
2023-07-28 14:19:55 +01:00
alias browse="mimeopen ."
# colourify things!
alias ls='ls --color=auto'
alias grep='grep --color=auto'
# Node stuff
alias ni="npm install"
alias ns="npm start"
alias nt="npm test"
nb() {
if [ $# -eq 0 ]; then
command npm run build
else
for arg in "$@"
do
command npm run build-${arg}
done
fi
}
nvm() { # This takes ~1sec, so we lazy-load it.
unset $0
source "/usr/share/nvm/init-nvm.sh"
$0 $@
}
npx () {
command $(npm bin)/$@
}
eval $(thefuck --alias)
eval "$(pazi init zsh)"
# git aliases
alias gs="git status"
alias gd="git diff"
alias git-root='cd $(git root)'
hub() {
if [ $# -eq 1 ]; then
command git clone git@github.com:RealOrangeOne/${1} --recursive && cd ${1}
else
command git clone git@github.com:${1}/${2} --recursive && cd ${2}
fi
}
git-cleanup() {
command git checkout master
command git branch --merged | grep -v '*' | xargs -n 1 git branch -D
command git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -D
command git remote prune origin
command git checkout -
}
2023-07-28 14:32:11 +01:00
alias lg="lazygit"
2023-07-29 21:46:06 +01:00
alias yay="paru"
# miscellaneous software aliases
alias serve="/usr/bin/python3 -m http.server"
alias regen-ssh-conf="assh config build > ~/.ssh/config"
alias clip="xclip -selection clipboard"
alias cl="climate"
alias tmux-cleanup="tmux list-sessions | grep -v attached | cut -d: -f1 | xargs -t -n1 tmux kill-session -t"
alias lock-screen="xdotool key 'Super_L+l'"
alias mux="tmuxinator start"
alias open-port="firewall-cmd --zone=public --add-port"
alias close-port="firewall-cmd --zone=public --remove-port"
alias reset-ports="firewall-cmd --complete-reload"