sync/shells/zshrc

242 lines
7.8 KiB
Bash

export HISTFILE=$HOME/.zsh_history
ZSH_THEME="af-magic"
source "$HOME/.antigen/antigen.zsh"
# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"
COMPLETION_WAITING_DOTS="true"
# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
HIST_STAMPS="dd.mm.yyyy"
setopt APPEND_HISTORY
HISTSIZE=12000
SAVEHIST=10000000
setopt INTERACTIVECOMMENTS
setopt HIST_EXPIRE_DUPS_FIRST
setopt EXTENDED_HISTORY
setopt APPEND_HISTORY SHARE_HISTORY HISTIGNOREALLDUPS
if [ -f /etc/zsh_command_not_found ] ; then
source /etc/zsh_command_not_found
fi
export DISABLE_AUTO_TITLE=true
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
export EDITOR='vim'
alias sudo='sudo '
alias con='git x php app/console'
alias srm='srm -dv'
alias disphost='export DISPLAY=:0.0'
alias ll='ls -AglhF'
alias la='ls -A'
alias l='ls -CF'
alias logout='sudo pkill -u $USER'
function fixsh(){
sed -i -e $1"d" ~/.ssh/known_hosts
}
alias tmux='tmux -2'
alias less='less -R'
alias tree='tree -C'
alias skim="(head -5; tail -5) <"
alias cp='rsync -ha --info=progress2 "$@"'
function mv() { /bin/mv -v "$@" }
function m() { mv "$@" }
compdef _cp c m mv cp copy
alias dt='date "+%F %T"'
alias awake='disphost; while true; do xdotool mousemove 0 0; sleep 60; done'
alias adk='/home/stonewareslord/Applications/adk/bin/studio.sh & disown'
alias resource='. ~/.zshrc'
alias etup='sudo etc-update'
alias search='apt-cache search'
if [ "$(uname)" != "Darwin" ]; then
# Not Mac
alias ls='ls --color=always -F'
alias steam='sudo kill -9 `pidof steam`;sudo unshare -n -- sh -c "ifconfig lo up;sudo -u stonewareslord steam" > /dev/null 2>&1 & disown'
alias matlab='matlab -glnx86'
alias bat='upower -i /org/freedesktop/UPower/devices/battery_BAT0| grep -E "state|to\ full|percentage"'
fi
if test -f /etc/lsb-release; then
# Ubuntu
alias install='sudo apt-get --show-progress install'
alias remove='sudo apt-get --show-progress remove'
alias update='sudo apt-get update'
alias upgrade='sudo apt-get --show-progress upgrade'
alias autoremove='sudo apt-get --show-progress autoremove'
alias updateall='sudo sh -c "apt-get update;apt-get upgrade -y;apt-get dist-upgrade -y;apt-get autoremove -y"'
elif test -f /etc/gentoo-release; then
# Gentoo
ins(){
echo "args: $*"
sudo zsh -c "emerge --autounmask-write -av $*"
}
alias update='cd /usr/portage&&sudo zsh -c "git up&&eix-update";\cd ->/dev/null'
alias upgrade='sudo emerge --update --newuse --with-bdeps=y --deep --verbose -t -a --keep-going=y @world'
fi
alias ..='k ..'
alias ...='k ../..'
alias ....='k ../../..'
alias .....='k ../../../..'
alias ......='k ../../../../..'
alias .......='k ../../../../../..'
alias ........='k ../../../../../../..'
alias .........='k ../../../../../../../..'
alias ..........='k ../../../../../../../../..'
alias ...........='k ../../../../../../../../../..'
alias ............='k ../../../../../../../../../../..'
alias .............='k ../../../../../../../../../../../..'
alias ..............='k ../../../../../../../../../../../../..'
alias ...............='k ../../../../../../../../../../../../../..'
alias ytdl="youtube-dl $@ -x --audio-format mp3 --audio-quality 0 -c -o '%(title)s.%(ext)s'"
alias tux="wemux"
alias rmgit="git remote rm origin;git remote rm https;git remote rm oOrigin;git remote rm oHttps"
alias rname="while true;do echo -n \"Rename: \";read A;echo -n \"To: \";read B;i3-msg 'rename workspace $A to $B';done"
alias g="git $@"
alias stdns="sudo sh -c 'echo nameserver 8.8.8.8 > /etc/resolv.conf'"
alias fvim="vim -u NONE +\"so ~/.vim/plugged/flappyvird-vim/plugin/flappyvird.vim\" +\"so ~/.vim/plugged/flappyvird-vim/autoload/flappyvird.vim\" +\":FlappyVird\" +\":q\""
alias fk='k `fzf --no-mouse -m -1 -x`'
alias fkill='ps -ef | sed 1d | fzf --no-mouse -m -1 -x | awk "{print $2}" | xargs kill -${1:-9}'
alias susp="echo mem | sudo tee /sys/power/state >/dev/null"
alias aoeu='setxkbmap -layout us -option "'
alias asdf='setxkbmap -layout dvorak -option ""'
alias -s html="firefox"
alias -s log="less -MN"
alias -s odt="libreoffice"
alias -s doc="libreoffice"
alias -s docx="libreoffice"
alias -g c='rsync -ha --info=progress2 "$@"'
alias -g F='`fzf --no-mouse -m -1 -x`'
alias -g nify=" > /dev/null 2>&1 &"
alias -g nifyd=" > /dev/null 2>&1 & disown"
alias -g L="2>&1|less"
#alias -g L="2>&1|vimpager"
alias -g G='|& ag'
export FZF_COMPLETION_OPTS='--no-mouse -m -1 -x'
function ctar(){
tar -cf - $@|pv -WcN tar -s $(echo $(du -sb $@|awk '{print $1}'|tr '\n' '+')0|bc)|gzip|pv -WcN dest
#tar -cf - $@|pv -WcN tar -s $(echo $(du -sb $@|awk '{print $1}'|tr '\n' '+')0|bc)|gzip|pv -WcN dest
}
function offline(){
echo unshare -n -- sh -c "sudo -u stonewareslord zsh -c '$@'"
sudo unshare -n -- sh -c "sudo -u stonewareslord zsh -c '$@'"
}
function smon(){
timeout 1s pdsh -R ssh -w 10.0.1.196,10.0.1.207 "$@"
}
function dnstest(){
echo "resolv.conf:"
cat /etc/resolv.conf
echo "Testing DNS:"
dig google.com
echo "Testing ping:"
ping -c 2 8.8.8.8
echo "Testing IP curl:"
curl -k http://98.26.78.121/b/
echo
echo "Testing DNS"
curl ifconfig.me
}
function cinitify(){
mkdir $2
cd $2
git init
git remote add origin git@austenwares.com:$1/$2.git
git remote add https https://austenwares.com/gitlab/$1/$2.git
#Offline mode
git remote add oOrigin git@10.0.1.200:$1/$2.git
git remote add oHttps https://10.0.1.200/gitlab/$1/$2.git
git remote -v
git config http.sslVerify false
if [[ $3 == "-v" ]] ; then
# Vagrant repository
vagrant init $4
echo ".vagrant" > .gitignore
git add .
git commit -m "Initial commit"
vagrant up
elif [[ ! $3 == "-r" ]] ; then
echo -n "Pull from: "
read from
git pull $from
git checkout master
fi
}
function initify(){
git init
git remote add origin git@austenwares.com:$1/$2.git
git remote add https https://austenwares.com/gitlab/$1/$2.git
#Offline mode
git remote add oOrigin git@10.0.1.200:$1/$2.git
git remote add oHttps https://10.0.1.200/gitlab/$1/$2.git
git remote -v
git config http.sslVerify false
if [[ ! $3 == "-r" ]] ; then
echo -n "Pull from: "
read from
git pull $from
git checkout master
fi
}
function tsh(){
ssh $* -X
if which ponysay >/dev/null; then
ponysay "Connection closed!"
else
echo "\n\n\n\n\n\n\n\n\n\nSESSION CLOSED\n\n\n\n\n\n\n\n\n\n"
fi
}
function mcl(){
mkdir -p $1
cd $1
}
function k(){
#More than 1 arguement
if [[ $# > 1 ]] ; then
vim $@
elif [ -d "$@" ] ; then
#cd then ls
cd "$@" && ls
elif [[ "$@" == "-" ]] ; then
#Because if this isn't here, k - won't work
cd - && ls
elif [ -f "$@" ] ; then
#Extract if it's extractable
case $1 in
*.tar.xz) pv $1|tar xJf -;;
*.tar.bz2) pv $1|tar xjf -;;
*.tar.gz) pv $1|tar xzf -;;
*.tar) pv $1|tar xf -;;
*.tbz2) pv $1|tar xjf -;;
*.tgz) pv $1|tar xzf -;;
*.bz2) bunzip2 $1 ;;
*.rar) rar x $1 ;;
*.gz) gunzip $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1 ;;
*.7z) 7z x $1 ;;
*) vim $1
esac
else
#Edit with vim
echo -n "vim? "
read a
vim "$@"
fi
}
source ~/.zsh/*.zsh
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
printf "git-annex..."
antigen bundle Schnouki/git-annex-zsh-completion
printf "omg..."
antigen bundle stonewareslord/omg
printf "theme.."
antigen theme stonewareslord/oh-my-git-themes af-magic
printf "lpr..."
antigen bundle stonewareslord/lpr
printf "zsh-completions..."
antigen bundle zsh-users/zsh-completions src
printf "autoenv..."
antigen bundle sharat87/autoenv
printf "syntax-highlighting..."
antigen bundle zsh-users/zsh-syntax-highlighting
printf "applying..."
antigen apply
echo "done"