sync/shells/zshrc

277 lines
8.7 KiB
Bash
Raw Normal View History

export HISTFILE=$HOME/.zsh_history
ZSH_THEME="af-magic"
# Uncomment the following line to enable command auto-correction.
2014-09-12 19:03:40 -04:00
# ENABLE_CORRECTION="true"
2014-08-29 09:46:43 -04:00
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"
2014-08-29 09:46:43 -04:00
HIST_STAMPS="dd/mm/yyyy"
setopt APPEND_HISTORY
HISTSIZE=12000
SAVEHIST=10000000
setopt HIST_EXPIRE_DUPS_FIRST
setopt EXTENDED_HISTORY
2015-03-02 11:20:59 -05:00
setopt APPEND_HISTORY SHARE_HISTORY HISTIGNOREALLDUPS
# export PAGER=/usr/bin/w3m
2015-02-11 18:44:36 -05:00
plugins=(wd gem pass pip python sudo vagrant)
DISABLE_AUTO_UPDATE="true"
source "$HOME/.antigen/antigen.zsh"
printf "omg..."
2015-03-12 16:54:37 -04:00
antigen bundle stonewareslord/omg
2015-02-11 18:44:36 -05:00
printf "pass..."
antigen bundle pass
printf "sudo..."
antigen bundle sudo
printf "vagrant..."
antigen bundle vagrant
printf "oh-my-git..."
antigen theme stonewareslord/oh-my-git-themes af-magic
2015-02-11 18:44:36 -05:00
printf "liquidprompt..."
2015-03-26 00:51:51 -04:00
antigen bundle stonewareslord/lpr
2015-02-11 18:44:36 -05:00
printf "zsh-completions..."
2015-01-03 00:34:38 -05:00
antigen bundle zsh-users/zsh-completions src
2015-02-11 18:44:36 -05:00
printf "autoenv..."
2015-01-05 09:15:48 -05:00
antigen bundle sharat87/autoenv
2015-02-11 18:44:36 -05:00
printf "syntax-highlighting..."
antigen bundle zsh-users/zsh-syntax-highlighting
printf "applying..."
antigen apply
2015-02-11 18:44:36 -05:00
echo "done"
if [ -f /etc/zsh_command_not_found ] ; then
source /etc/zsh_command_not_found
fi
2015-03-25 14:25:22 -04:00
export DISABLE_AUTO_TITLE=true
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
2014-08-29 09:46:43 -04:00
export EDITOR='vim'
if [ "$(uname)" != "Darwin" ]; then
alias ls='ls --color=always -F'
fi
2015-01-02 19:37:17 -05:00
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 srm='srm -dv'
alias bat='upower -i /org/freedesktop/UPower/devices/battery_BAT0| grep -E "state|to\ full|percentage"'
alias disphost='export DISPLAY=:0.0'
2015-01-14 22:27:59 -05:00
alias ll='ls -AglhF'
alias la='ls -A'
2015-01-16 11:11:49 -05:00
alias l='ls -CF'
alias logout='sudo pkill -u $USER'
2015-03-25 14:25:22 -04:00
function fixsh(){
sed -i -e $1"d" ~/.ssh/known_hosts
2015-03-25 14:25:22 -04:00
}
alias tmux='tmux -2'
2015-01-20 07:43:44 -05:00
alias less='less -R'
alias tree='tree -C'
2015-01-20 07:43:44 -05:00
alias grep="grep -P"
alias skim="(head -5; tail -5) <"
2015-02-20 17:00:42 -05:00
alias -g c='rsync -ha --info=progress2 "$@"'
alias cp='rsync -ha --info=progress2 "$@"'
2015-01-03 00:34:38 -05:00
function mv() { /bin/mv -v "$@" }
function m() { mv "$@" }
2015-02-20 17:00:42 -05:00
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'
2014-09-20 23:09:59 -04:00
alias adk='/home/stonewareslord/Applications/adk/bin/studio.sh & disown'
alias resource='. ~/.zshrc'
2015-02-10 10:04:45 -05:00
function ins(){
2015-04-18 23:12:55 -04:00
sudo zsh -c "emerge --autounmask-write -av $@"
2015-02-10 10:04:45 -05:00
}
2015-02-22 16:26:41 -05:00
alias etup='sudo etc-update'
alias search='apt-cache search'
2015-03-23 18:35:55 -04:00
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 ..='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"
2014-08-29 09:46:43 -04:00
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 $@"
2015-04-18 23:12:55 -04:00
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\""
2014-09-28 11:45:17 -04:00
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 slp='smon ./x&DISPLAY=:0.0 i3lock -di `echo $(shuf -n1 -e ~/.i3/wall/*) | tee /tmp/wall`'
2015-01-13 13:46:35 -05:00
alias updateall='sudo sh -c "apt-get update;apt-get upgrade -y;apt-get dist-upgrade -y;apt-get autoremove -y"'
2015-04-27 08:21:57 -04:00
alias susp="echo mem|tee /sys/power/state 2>&1 >/dev/null||echo mem|sudo tee /sys/power/state 2>&1 >/dev/null"
2014-08-19 13:20:34 -04:00
alias -s html="firefox"
alias -s log="less -MN"
alias -s odt="libreoffice"
alias -s doc="libreoffice"
alias -s docx="libreoffice"
2014-09-28 11:45:17 -04:00
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"
2015-01-28 23:02:40 -05:00
alias -g G='|& ag'
2014-09-12 19:03:40 -04:00
alias -g AW='austenwares.com'
2014-09-28 11:45:17 -04:00
export FZF_COMPLETION_OPTS='--no-mouse -m -1 -x'
2015-02-23 13:12:42 -05:00
function ctar(){
2015-04-19 16:47:48 -04:00
tar -cf - $@|pv -WcN tar -s $(echo $(du -sb $@|awk '{print $1}'|tr '\n' '+')0|bc)|pv -WcN gzip|gzip|pv -WcN dest
2015-02-23 13:12:42 -05:00
}
2015-02-06 07:17:24 -05:00
function pcat(){
pygmentize -f terminal "$1" | less -R
}
function offline(){
echo unshare -n -- sh -c "sudo -u stonewareslord zsh -c '$@'"
sudo unshare -n -- sh -c "sudo -u stonewareslord zsh -c '$@'"
}
2014-11-07 21:25:46 -05:00
function smon(){
timeout 1s pdsh -R ssh -w 10.0.1.196,10.0.1.207 "$@"
2014-11-07 21:25:46 -05:00
}
2014-08-29 09:46:43 -04:00
function dnstest(){
echo "resolv.conf:"
cat /etc/resolv.conf
echo "Testing DNS:"
dig google.com
2014-08-29 09:46:43 -04:00
echo "Testing ping:"
ping -c 2 8.8.8.8
2014-08-29 09:46:43 -04:00
echo "Testing IP curl:"
curl -k http://98.26.78.121/b/
echo
2014-08-29 09:46:43 -04:00
echo "Testing DNS"
2014-09-20 23:09:10 -04:00
curl ifconfig.me
2014-08-29 09:46:43 -04:00
}
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
2015-01-02 18:50:23 -05:00
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 k(){
if [[ $# > 1 ]] ; then
#More than 1 arguement
echo -n "Exec [mcvxX]: "
read a
if [[ $a == "m" ]] ; then
mv $@
elif [[ $a == "c" ]] ; then
cp $@
elif [[ $a == "v" ]] ; then
vim $@
elif [[ $a == "x" ]] ; then
rm "$@"
elif [[ $a == "XX" ]] ; then
rm -rf "$@"
fi
elif [ -d "$@" ] ; then
#cd then ls
cd "$@" && ls
2014-08-11 15:14:46 -04:00
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
2015-03-12 16:54:37 -04:00
*.tar.xz) pv $1|tar xJf -;;
2015-02-11 18:44:36 -05:00
*.tar.bz2) pv $1|tar xjf -;;
*.tar.gz) pv $1|tar xzf -;;
2015-04-18 23:12:55 -04:00
*.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
echo -n "Exec [dcvfxX]: "
read a
if [[ $a == "d" ]] ; then
#Create directory
mkdir $@
elif [[ $a == "c" ]] ; then
#Create directory and cd into it
mkdir $@
cd $@
elif [[ $a == "v" ]] ; then
#Edit with vim
vim "$@"
elif [[ $a == "f" ]] ; then
#Open with Firefox
firefox "$@"
elif [[ $a == "x" ]] ; then
#rm file
rm "$@"
elif [[ $a == "X" ]] ; then
#rm directory
rmdir "$@"
elif [[ $a == "XX" ]] ; then
#rm -rf everything
rm -rf "$@"
fi
fi
}
source ~/.zsh/*.zsh
2015-04-06 10:43:48 -04:00
source /home/stonewareslord/git/sync/zsh/theme-and-appearance.zsh
source /home/stonewareslord/git/sync/zsh/completion.zsh
source /home/stonewareslord/git/sync/zsh/key-bindings.zsh
source /home/stonewareslord/git/sync/zsh/spectrum.zsh
source /home/stonewareslord/git/sync/zsh/sudo.zsh
#source /home/stonewareslord/git/sync/zsh/misc.zsh
#source /home/stonewareslord/git/sync/zsh/history.zsh
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh