From 18073b087d4ea05db8d2cdf5c9f9a0fc8c56e216 Mon Sep 17 00:00:00 2001 From: Bilal Syed Hussain Date: Sun, 16 Jun 2013 16:39:20 +0100 Subject: [PATCH] settings --- .gitconfig | 4 +-- .inputrc | 4 +++ .slate | 73 +++++++++++++++++++++++++++++++++++++++--------- .zshrc | 81 ++++++++++++++++++++++++++++++++++++++++++++++-------- 4 files changed, 136 insertions(+), 26 deletions(-) diff --git a/.gitconfig b/.gitconfig index a567520..e41b399 100644 --- a/.gitconfig +++ b/.gitconfig @@ -1,7 +1,7 @@ [user] name = Bilal Syed Hussain - email = bh246@st-andrews.ac.uk - bemail = bilalshussain@gmail.com + semail = bh246@st-andrews.ac.uk + email = bilalshussain@gmail.com [color] ui = auto [core] diff --git a/.inputrc b/.inputrc index 8dabd3c..8bf4854 100644 --- a/.inputrc +++ b/.inputrc @@ -24,3 +24,7 @@ set output-meta on set convert-meta off set match-hidden-files off + +"\e[A": history-search-backward +"\e[B": history-search-forward +set show-all-if-ambiguous on diff --git a/.slate b/.slate index f97791b..1959b52 100644 --- a/.slate +++ b/.slate @@ -3,27 +3,74 @@ config windowHintsShowIcons true config windowHintsIgnoreHiddenWindows false config windowHintsSpread true config windowHintsShowIcons true - - -# Cmd+G brings up grid like Divvy (for each monitor) -bind g:cmd grid padding:5 0:8,8 1:8,5 - + + # Abstract positions alias full move screenOriginX;screenOriginY screenSizeX;screenSizeY + alias lefthalf move screenOriginX;screenOriginY screenSizeX/2;screenSizeY alias righthalf move screenOriginX+screenSizeX/2;screenOriginY screenSizeX/2;screenSizeY + +alias tophalf move screenOriginX;screenOriginY screenSizeX;screenSizeY/2 +alias bottomhalf move screenOriginX;screenOriginY+screenSizeY/2 screenSizeX;screenSizeY/2 + alias topleft corner top-left resize:screenSizeX/2;screenSizeY/2 alias topright corner top-right resize:screenSizeX/2;screenSizeY/2 alias bottomleft corner bottom-left resize:screenSizeX/2;screenSizeY/2 alias bottomright corner bottom-right resize:screenSizeX/2;screenSizeY/2 - -# Numpad location Bindings -bind 1:ctrl;alt;cmd ${lefthalf} -bind 2:ctrl;alt;cmd ${righthalf} +alias rightLot move screenOriginX+(screenSizeX/9*4);screenOriginY (screenSizeX/9*5);screenSizeY +alias rightMost move screenOriginX+(screenSizeX/9*3)-50;screenOriginY (screenSizeX/9*6)+50;screenSizeY +alias leftLess move screenOriginX;screenOriginY (screenSizeX/9*4);screenSizeY + +# The hyper key +alias hyper ctrl;alt;cmd;shift + +# Hyper+G brings up grid (for each monitor) +bind g:${hyper} grid padding:5 0:8,8 1:8,5 + +# To Resize windows +bind 1:${hyper} ${lefthalf} +bind 1:${hyper} ${lefthalf} +bind 2:${hyper} ${righthalf} + +bind 3:${hyper} ${topleft} +bind 4:${hyper} ${topright} + +bind 5:${hyper} ${bottomleft} +bind 6:${hyper} ${bottomright} + +bind 7:${hyper} ${tophalf} +bind 8:${hyper} ${bottomhalf} + +bind q:${hyper} ${leftLess} +bind w:${hyper} ${rightLot} +bind e:${hyper} ${rightMost} +bind f:${hyper} ${full} + + +# Focus Bindings +bind right:${hyper} focus right +bind left:${hyper} focus left +bind up:${hyper} focus up +bind down:${hyper} focus down + +bind l:${hyper} focus right +bind h:${hyper} focus left +bind k:${hyper} focus up +bind j:${hyper} focus down + +bind b:${hyper} focus behind + +# Other bindings + +bind ;:${hyper} relaunch +bind u:${hyper} undo + +# Screen bindings +bind n:${hyper} throw left +bind m:${hyper} throw right + -bind 3:ctrl;alt;cmd ${topleft} -bind 4:ctrl;alt;cmd ${topright} +bind i:${hyper} hint hint -bind 5:ctrl;alt;cmd ${bottomleft} -bind 6:ctrl;alt;cmd ${bottomright} diff --git a/.zshrc b/.zshrc index 692b87b..d72fdf7 100644 --- a/.zshrc +++ b/.zshrc @@ -4,23 +4,30 @@ export PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting #export ZSH_THEME=avery -export ZSH_THEME="powerline" -export POWERLINE_RIGHT_A="exit-code" -export POWERLINE_HIDE_USER_NAME="true" -export POWERLINE_HIDE_HOST_NAME="true" -export POWERLINE_DISABLE_RPROMPT="true" -export POWERLINE_RIGHT_B="" -export POWERLINE_RIGHT_A="" +#export ZSH_THEME="powerline" +#export POWERLINE_RIGHT_A="exit-code" +#export POWERLINE_HIDE_USER_NAME="true" +#export POWERLINE_HIDE_HOST_NAME="true" +#export POWERLINE_DISABLE_RPROMPT="true" +#export POWERLINE_RIGHT_B="" +#export POWERLINE_RIGHT_A="" export DEFAULT_USER=Bilalh plugins=(funcs todo) -plugins+=(osx ruby autojump encode64 gem git-extras pip battery brew pygmentize python zsh-syntax-highlighting history-substring-search ) +plugins+=(osx ruby autojump encode64 gem git-extras + pip battery brew pygmentize python + zsh-syntax-highlighting history-substring-search ) DISABLE_CORRECTION=true source $ZSH/oh-my-zsh.sh +zstyle '*' single-ignored complete +#setopt menu_complete + +export PROMPT='[%28<...<%4(~:...:)%3~/] %# ' + # History HISTFILE=$HOME/.zsh_history HISTSIZE=40000 @@ -38,9 +45,10 @@ setopt HIST_IGNORE_SPACE # Don't save command starting with a space unsetopt cdablevars export EDITOR='vim' # default editor -export LESS='-R' +export LESS='-R' # Less colour export FIGNORE=$FIGNORE:.o:.out:.pyc:.pdfsync:.log:.bbl:.aux:.blg:.out:.toc: -export CLICOLOR=1 + +export TODOTXT_SORT_COMMAND='env LC_COLLATE=C sort -k 2,2 -k 1,1n' # # light colours @@ -89,12 +97,14 @@ PATH=$HOME/.rvm/bin:$PATH # Add RVM to PATH for scripting alias tl='todo list' function t(){ - todo ${@:-list} + todo ${@:-pv} } alias f='dirs -v' #Autoload autoload -U zcalc +autoload -U zmv +autoload -U zrecompile [ -f ~/.local/bin/bashmarks.sh ] && source ~/.local/bin/bashmarks.sh #Bindings @@ -109,10 +119,47 @@ bindkey 'C' forward-word bindkey 'OD' beginning-of-line bindkey 'OC' end-of-line +bindkey '' backward-kill-line + # for trying # bindkey -s '^[3' \# bindkey -s '£' \# +# Press C-x a to ++ the the last number in the command (e.g for playing videos) +_increase_number() { + local -a match mbegin mend + [[ $LBUFFER =~ '([0-9]+)[^0-9]*$' ]] && + LBUFFER[mbegin,mend]=$(printf %0${#match[1]}d $((10#$match+${NUMERIC:-1}))) +} +zle -N increase-number _increase_number +bindkey '^Xa' increase-number +bindkey -s '^Xx' '^[-^Xa' + +#recursive C-R -- http://chneukirchen.org/blog/archive/2013/03/10-fresh-zsh-tricks-you-may-not-know.html +autoload -Uz narrow-to-region +function _history-incremental-preserving-pattern-search-backward +{ + local state + MARK=CURSOR # magick, else multiple ^R don't work + narrow-to-region -p "$LBUFFER${BUFFER:+>>}" -P "${BUFFER:+<<}$RBUFFER" -S state + zle end-of-history + zle history-incremental-pattern-search-backward + narrow-to-region -R state +} +zle -N _history-incremental-preserving-pattern-search-backward +bindkey "^R" _history-incremental-preserving-pattern-search-backward +bindkey -M isearch "^R" history-incremental-pattern-search-backward +bindkey "^S" history-incremental-pattern-search-forward + +# find zsh info +function zman() { + PAGER="less -g -s '+/^ "$1"'" man zshall +} + +# Force file name completion on C-x TAB, Shift-TAB. +zle -C complete-files complete-word _generic +zstyle ':completion:complete-files:*' completer _files +bindkey "^X^I" complete-files # man pages IN COLOUR! export LESS_TERMCAP_mb=$'\E[01;31m' # begin blinking @@ -125,3 +172,15 @@ export LESS_TERMCAP_us=$'\E[04;38;5;146m' # begin underline] ZSH_HIGHLIGHT_STYLES[path]='none' + + +function avgBitRate(){ + parallel 'afinfo {} | grep "bit rate" ' ::: **/*.(mp3|m4a) |awk '\ + {sum+=$3; if(min==""){min=max=$3}; if($3>max) {max=$3} else if($3< min) {min=$3}; \ + if($3>325000){lossless++} else if($3>256000){n320++} else if($3>192000){n256++} else if($3 >160000){n192++} else if($3 > 128000){n160++} else{nless++ } }\ + END {printf " Total: %d\n Bitrates: \033[0m\033[32mAverage\033[0m %.0f kbps \033[0m\033[32mMax\033[0m %0.f kbps \033[0m\033[32mMin\033[0m %0.f kbps\ + Types: 320+: %d 320: %d 256: %d 192: %d 160: %d 160-: %d \n",\ + NR, sum/NR/1000,max/1000, min/1000,\ + lossless, n320, n256, n192, n160, nless\ + }' +}