Skip to content

Instantly share code, notes, and snippets.

@Xithrius
Last active December 30, 2020 19:20
Show Gist options
  • Save Xithrius/98b040f1abead75c7949142ab2dc274f to your computer and use it in GitHub Desktop.
Save Xithrius/98b040f1abead75c7949142ab2dc274f to your computer and use it in GitHub Desktop.
zsh config
# https://github.com/rupa/z/
. /usr/share/z/z.sh
# Paths
export PATH=$HOME/bin:/usr/local/bin:$PATH
export PATH=/home/xithrius/.local/bin:$PATH
export PATH=/home/xithrius/.emacs.d/bin:$PATH
export PIPENV_IGNORE_VIRTUALENVS=1
# Path to your oh-my-zsh installation.
export ZSH="/home/xithrius/.oh-my-zsh"
# Adding colors to lightline
export TERM=xterm-256color
# Loading functions
autoload -U compinit && compinit
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes for more!
ZSH_THEME="zeta"
plugins=(
git
git-extras
gitfast
history-substring-search
colorize
autopep8
zsh-autosuggestions # https://github.com/zsh-users/zsh-autosuggestions
zsh-syntax-highlighting # https://github.com/zsh-users/zsh-syntax-highlighting
command-time # https://github.com/popstas/zsh-command-time
)
source $ZSH/oh-my-zsh.sh
# Short and neat
alias szsh="source ~/.zshrc"
alias zshrc="vim ~/.zshrc"
alias ohmyzsh="vim ~/.oh-my-zsh"
alias py="python3"
alias python="python3"
alias postgres="sudo -u postgres psql"
alias executable="chmod +x"
alias gn="shutdown"
# Fun
alias fetch="neofetch | lolcat"
# Web requests
alias weather="curl wttr.in"
alias moon="curl wttr.in/moon"
alias califire="curl -s http://iscaliforniaonfire.com/ | html2text - | tail -n4 | head -1 | cut -f2 -d' '"
alias ytdl="youtube-dl -o '~/Music/%(title)s.mp3' -f 'bestaudio/best' --yes-playlist"
alias ytdl_vid="youtube-dl -o '~/Videos/YouTube/%(title)s' --yes-playlist"
# Python inline scripts
alias xkcd="python -c \"__import__('webbrowser').open('https://c.xkcd.com/random/comic')\""
alias lenof="python -c \"print(len(' '.join(__import__('sys').argv[1:])))\""
# Neat stuff
# alias command_amount="echo \"`history -1 | grep -oE '^\s*[0-9]+' | awk '{$1=$1};1'` total executed commands.\""
# Customizing custom plugins
zsh_command_time() {
if [ -n "$ZSH_COMMAND_TIME" ]; then
hours=$(($ZSH_COMMAND_TIME/3600))
min=$(($ZSH_COMMAND_TIME/60))
sec=$(($ZSH_COMMAND_TIME%60))
if [ "$ZSH_COMMAND_TIME" -le 60 ]; then
timer_show="$fg[green]$ZSH_COMMAND_TIME seconds"
elif [ "$ZSH_COMMAND_TIME" -gt 60 ] && [ "$ZSH_COMMAND_TIME" -le 180 ]; then
timer_show="$fg[yellow]$min minutes $sec seconds"
else
if [ "$hours" -gt 0 ]; then
min=$(($min%60))
timer_show="$fg[red]$hours hours $min minutes $sec seconds"
else
timer_show="$fg[red]$min minutes $sec seconds"
fi
fi
printf "${ZSH_COMMAND_TIME_MSG}\n" "$timer_show"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment