Various improvemnts to zshrc. Added os detection

This commit is contained in:
Austen Adler 2015-07-29 16:27:13 -04:00
parent 7f894b96b8
commit 1c2329a489

View File

@ -7,7 +7,7 @@ COMPLETION_WAITING_DOTS="true"
# Uncomment the following line if you want to change the command execution time # Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output. # stamp shown in the history command output.
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" # The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
HIST_STAMPS="dd/mm/yyyy" HIST_STAMPS="dd.mm.yyyy"
setopt APPEND_HISTORY setopt APPEND_HISTORY
HISTSIZE=12000 HISTSIZE=12000
SAVEHIST=10000000 SAVEHIST=10000000
@ -15,20 +15,12 @@ setopt INTERACTIVECOMMENTS
setopt HIST_EXPIRE_DUPS_FIRST setopt HIST_EXPIRE_DUPS_FIRST
setopt EXTENDED_HISTORY setopt EXTENDED_HISTORY
setopt APPEND_HISTORY SHARE_HISTORY HISTIGNOREALLDUPS setopt APPEND_HISTORY SHARE_HISTORY HISTIGNOREALLDUPS
# export PAGER=/usr/bin/w3m
if [ -f /etc/zsh_command_not_found ] ; then if [ -f /etc/zsh_command_not_found ] ; then
source /etc/zsh_command_not_found source /etc/zsh_command_not_found
fi fi
export DISABLE_AUTO_TITLE=true 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 PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
export EDITOR='vim' export EDITOR='vim'
if [ "$(uname)" != "Darwin" ]; then
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
alias sudo='sudo ' alias sudo='sudo '
alias con='git x php app/console' alias con='git x php app/console'
alias srm='srm -dv' alias srm='srm -dv'
@ -52,17 +44,31 @@ alias dt='date "+%F %T"'
alias awake='disphost; while true; do xdotool mousemove 0 0; sleep 60; done' alias awake='disphost; while true; do xdotool mousemove 0 0; sleep 60; done'
alias adk='/home/stonewareslord/Applications/adk/bin/studio.sh & disown' alias adk='/home/stonewareslord/Applications/adk/bin/studio.sh & disown'
alias resource='. ~/.zshrc' alias resource='. ~/.zshrc'
function ins(){
echo "args: $*"
sudo zsh -c "emerge --autounmask-write -av $*"
}
alias etup='sudo etc-update' alias etup='sudo etc-update'
alias search='apt-cache search' alias search='apt-cache search'
alias install='sudo apt-get --show-progress install' if [ "$(uname)" != "Darwin" ]; then
alias remove='sudo apt-get --show-progress remove' # Mac
alias update='sudo apt-get update' alias ls='ls --color=always -F'
alias upgrade='sudo apt-get --show-progress upgrade' 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 autoremove='sudo apt-get --show-progress autoremove' alias matlab='matlab -glnx86'
alias bat='upower -i /org/freedesktop/UPower/devices/battery_BAT0| grep -E "state|to\ full|percentage"'
elif 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
function 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 ../../..'
@ -86,8 +92,6 @@ 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 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 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 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`'
alias updateall='sudo sh -c "apt-get update;apt-get upgrade -y;apt-get dist-upgrade -y;apt-get autoremove -y"'
alias susp="echo mem | sudo tee /sys/power/state >/dev/null" alias susp="echo mem | sudo tee /sys/power/state >/dev/null"
alias aoeu='setxkbmap -layout us -option "' alias aoeu='setxkbmap -layout us -option "'
alias asdf='setxkbmap -layout dvorak -option ""' alias asdf='setxkbmap -layout dvorak -option ""'
@ -108,9 +112,6 @@ 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
#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 pcat(){
pygmentize -f terminal "$1" | less -R
}
function offline(){ function offline(){
echo unshare -n -- sh -c "sudo -u stonewareslord zsh -c '$@'" echo unshare -n -- sh -c "sudo -u stonewareslord zsh -c '$@'"
sudo unshare -n -- sh -c "sudo -u stonewareslord zsh -c '$@'" sudo unshare -n -- sh -c "sudo -u stonewareslord zsh -c '$@'"
@ -219,11 +220,6 @@ function k(){
fi fi
} }
source ~/.zsh/*.zsh source ~/.zsh/*.zsh
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
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
printf "git-annex..." printf "git-annex..."
antigen bundle Schnouki/git-annex-zsh-completion antigen bundle Schnouki/git-annex-zsh-completion
@ -231,7 +227,7 @@ printf "omg..."
antigen bundle stonewareslord/omg antigen bundle stonewareslord/omg
printf "theme.." printf "theme.."
antigen theme stonewareslord/oh-my-git-themes af-magic antigen theme stonewareslord/oh-my-git-themes af-magic
printf "liquidprompt..." printf "lpr..."
antigen bundle stonewareslord/lpr antigen bundle stonewareslord/lpr
printf "zsh-completions..." printf "zsh-completions..."
antigen bundle zsh-users/zsh-completions src antigen bundle zsh-users/zsh-completions src
@ -242,9 +238,3 @@ antigen bundle zsh-users/zsh-syntax-highlighting
printf "applying..." printf "applying..."
antigen apply antigen apply
echo "done" echo "done"
#zshaddhistory () {
# print -sr -- "${1%%$'\n'}"
# fc -p ~/.zsh_history_detail
# print -sr -- "${1%%$'\n'} ### ${PWD} $(date '+%Y-%m-%d %R')"
# return 1
#}