From 1c2329a4894fd1430a0967def5851e075a51584f Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Wed, 29 Jul 2015 16:27:13 -0400 Subject: [PATCH] Various improvemnts to zshrc. Added os detection --- shells/zshrc | 60 ++++++++++++++++++++++------------------------------ 1 file changed, 25 insertions(+), 35 deletions(-) diff --git a/shells/zshrc b/shells/zshrc index 5aa4eeb..1b04c58 100644 --- a/shells/zshrc +++ b/shells/zshrc @@ -7,7 +7,7 @@ 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" +HIST_STAMPS="dd.mm.yyyy" setopt APPEND_HISTORY HISTSIZE=12000 SAVEHIST=10000000 @@ -15,20 +15,12 @@ setopt INTERACTIVECOMMENTS setopt HIST_EXPIRE_DUPS_FIRST setopt EXTENDED_HISTORY setopt APPEND_HISTORY SHARE_HISTORY HISTIGNOREALLDUPS -# export PAGER=/usr/bin/w3m - 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' -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 con='git x php app/console' 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 adk='/home/stonewareslord/Applications/adk/bin/studio.sh & disown' alias resource='. ~/.zshrc' -function ins(){ - echo "args: $*" - sudo zsh -c "emerge --autounmask-write -av $*" -} alias etup='sudo etc-update' alias search='apt-cache search' -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' +if [ "$(uname)" != "Darwin" ]; then + # 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"' +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 ../../..' @@ -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 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`' -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 aoeu='setxkbmap -layout us -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 } -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 '$@'" @@ -219,11 +220,6 @@ function k(){ fi } 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 printf "git-annex..." antigen bundle Schnouki/git-annex-zsh-completion @@ -231,7 +227,7 @@ printf "omg..." antigen bundle stonewareslord/omg printf "theme.." antigen theme stonewareslord/oh-my-git-themes af-magic -printf "liquidprompt..." +printf "lpr..." antigen bundle stonewareslord/lpr printf "zsh-completions..." antigen bundle zsh-users/zsh-completions src @@ -242,9 +238,3 @@ antigen bundle zsh-users/zsh-syntax-highlighting printf "applying..." antigen apply echo "done" -#zshaddhistory () { -# print -sr -- "${1%%$'\n'}" -# fc -p ~/.zsh_history_detail -# print -sr -- "${1%%$'\n'} ### ${PWD} $(date '+%Y-%m-%d %R')" -# return 1 -#}