Permalink
Browse files

tmux, vimrc, zsh and bash files.

  • Loading branch information...
1 parent 08b3e41 commit ed176daeefdab41c5d861922384ecf0f528bb776 sanket agarwal committed Jan 31, 2013
Showing with 571 additions and 0 deletions.
  1. +17 −0 .tmux.conf
  2. +40 −0 .vimrc
  3. +90 −0 .zshprompt
  4. +217 −0 .zshrc
  5. +207 −0 z/z.sh
View
@@ -0,0 +1,17 @@
+set -g prefix C-a
+unbind C-b
+bind C-a send-prefix
+bind-key C-a send-prefix
+bind r source-file ~/.tmux.conf \; display "Reloaded"
+bind | split-window -h
+bind - split-window -v
+bind h select-pane -L
+bind j select-pane -D
+bind k select-pane -U
+bind l select-pane -R
+bind -r C-h select-window -t :-
+bind -r C-l select-window -t :+
+bind-key J resize-pane -D 5
+bind-key K resize-pane -U 5
+bind-key H resize-pane -L 5
+bind-key L resize-pane -R 5
View
40 .vimrc
@@ -0,0 +1,40 @@
+source /usr/share/vim/google/google.vim
+inoremap jj <esc>
+set incsearch
+set hlsearch
+set number
+
+" perforce commands
+command! -nargs=* -complete=file PEdit :!g4 edit %
+command! -nargs=* -complete=file PRevert :!g4 revert %
+command! -nargs=* -complete=file PDiff :!g4 diff %
+
+function! s:CheckOutFile()
+ if filereadable(expand("%")) && ! filewritable(expand("%"))
+ let s:pos = getpos('.')
+ let option = confirm("Readonly file, do you want to checkout from p4?"
+ \, "&Yes\n&No", 1, "Question")
+ if option == 1
+ PEdit
+ endif
+ edit!
+ call cursor(s:pos[1:3])
+ endif
+endfunction
+au FileChangedRO * nested :call <SID>CheckOutFile()
+
+" Enable pathogen
+call pathogen#infect()
+syntax on
+filetype plugin indent on
+set colorcolumn=80
+set clipboard^=unnamed
+
+" Set window control prefix to tmux prefix
+map <C-A> <C-W>
+
+" Install NERDTree
+
+" Display the name of the file always.
+set modeline
+set ls=2
View
@@ -0,0 +1,90 @@
+function precmd {
+ local TERMWIDTH
+ (( TERMWIDTH = ${COLUMNS} - 1 ))
+
+ # Truncate the path if it's too long.
+ PR_FILLBAR=""
+ PR_PWDLEN=""
+
+ local promptsize=${#${(%):---(%n@%m:%l)---()--}}
+ local pwdsize=${#${(%):-%~}}
+
+ if [[ "$promptsize + $pwdsize" -gt $TERMWIDTH ]]; then
+ ((PR_PWDLEN=$TERMWIDTH - $promptsize))
+ else
+ PR_FILLBAR="\${(l.(($TERMWIDTH - ($promptsize + $pwdsize)))..${PR_HBAR}.)}"
+ fi
+}
+
+setprompt () {
+ setopt prompt_subst
+
+ # See if we can use colors.
+ autoload colors zsh/terminfo
+ if [[ "$terminfo[colors]" -ge 8 ]]; then
+ colors
+ fi
+ for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
+ #eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}'
+ #eval PR_LIGHT_$color='%{$fg[${(L)color}]%}'
+ eval PR_$color='%{$fg[${(L)color}]%}'
+ eval PR_LIGHT_$color='%{$terminfo[bold]$fg[${(L)color}]%}'
+ (( count = $count + 1 ))
+ done
+ PR_NO_COLOUR="%{$terminfo[sgr0]%}"
+
+ # See if we can use extended characters to look nicer.
+ typeset -A altchar
+ set -A altchar ${(s..)terminfo[acsc]}
+ PR_SET_CHARSET="%{$terminfo[enacs]%}"
+ PR_SHIFT_IN="%{$terminfo[smacs]%}"
+ PR_SHIFT_OUT="%{$terminfo[rmacs]%}"
+ PR_HBAR=${altchar[q]:--}
+ PR_ULCORNER=${altchar[l]:--}
+ PR_LLCORNER=${altchar[m]:--}
+ PR_LRCORNER=${altchar[j]:--}
+ PR_URCORNER=${altchar[k]:--}
+
+ # Decide if we need to set titlebar text.
+ case $TERM in
+ xterm*)
+ PR_TITLEBAR=$'%{\e]0;%(!.-=*[ROOT]*=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\a%}'
+ ;;
+ rxvt*)
+ PR_TITLEBAR=$'%{\e]2;%(!.-=*[ROOT]*=- | .)%n@%m:%~ | %y\a%}'
+ ;;
+ screen)
+ PR_TITLEBAR=$'%{\e_screen \005 (\005t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AN$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT$PR_NO_COLOUR '
+
+}
+
View
217 .zshrc
@@ -0,0 +1,217 @@
+# ---[ Environment ]---------------------------------------------------
+export PS_PERSONALITY='linux'
+[[ $TERM == eterm-color ]] && export TERM=xterm
+if [[ "$TERM" == "dumb" ]]
+then
+ unsetopt zle
+ unsetopt prompt_cr
+ unsetopt prompt_subst
+ unfunction precmd
+ unfunction preexec
+ PS1='$ '
+fi
+
+# ---[ Keychain ]------------------------------------------------------
+# keychain --nogui -q ~/.ssh/id_rsa
+# source ~/.keychain/localhost-sh
+
+# ---[ Autojump ]------------------------------------------------------
+source ~/z/z.sh
+function j () {
+ z "$@" || return 0;
+}
+function _z_preexec () {
+ z --add "$(pwd -P)";
+}
+
+preexec_functions=(_z_preexec $preexec_functions)
+
+# ---[ Modules ]-------------------------------------------------------
+zmodload zsh/complist
+autoload -Uz compinit
+compinit
+zmodload -a zsh/stat stat
+zmodload -a zsh/zpty zpty
+zmodload -ap zsh/mapfile mapfile
+
+# ---[ Modules ]-------------------------------------------------------
+. ~/.zshprompt
+setprompt
+
+# ---[ cdm function ]--------------------------------------------------
+function cdm () {
+ local tmp
+ if [[ -z "${TMUX}" ]]; then
+ echo 'fatal: Not inside tmux.'
+ return 1
+ fi
+ if [[ -n "$1" ]]; then
+ [[ "$1" == . ]] && tmp="${PWD}" || tmp="$1"
+ else
+ tmp="${HOME}"
+ fi
+ cd "${tmp}"
+ tmp="${PWD}"
+ tmux "set-option" "default-path" "${tmp}"
+ [[ -n "${DISPLAY}" ]] && tmp=on || tmp=off
+ tmux "set-option" "set-titles" "${tmp}"
+ echo .
+ return 0
+}
+
+# ---[ Autols ]--------------------------------------------------------
+function chpwd() {
+ case `pwd` in
+ *'git'*|'/tmp') ;;
+ *) ls --color -v ;;
+ esac
+}
+
+# ---[ Shell exports ]-------------------------------------------------
+export EDITOR="emacsclient"
+export PATH=~/svn/prefix/svn-trunk/bin:~/bin:~/bin/depot_tools:~/.ruby/bin:~/.python/bin:~/.cabal/bin:$PATH
+export PYTHONPATH=~/.python/lib
+export GEM_HOME=~/.ruby
+export PYTHONSTARTUP=~/.pythonrc
+export WORDCHARS='*?_-.[]~=&;!#$%^(){}<>'
+export ACK_PAGER='less -r'
+
+# ---[ Amazon AWS ]-------------------------------------------------
+export EC2_HOME=~/.ec2
+export PATH=$PATH:$EC2_HOME/bin
+export JAVA_HOME=/usr
+
+# ---[ GPG Key ]-------------------------------------------------------
+export GPGKEY=B8BB3FE9
+
+# ---[ Debian Developer ]----------------------------------------------
+export DEBFULLNAME="Ramkumar Ramachandra"
+export DEBEMAIL="artagnon@gmail.com"
+
+# ---[ Simple calculator ]---------------------------------------------
+function calc () {
+ awk "BEGIN { print $@ }"
+}
+
+# ---[ Aliases ]-------------------------------------------------------
+# abbreviations
+function l () {
+ case "$1" in
+ date|mtime)
+ shift
+ ls --color -vt "$@"
+ ;;
+ atime)
+ shift
+ ls --color -vu "$@"
+ ;;
+ recent)
+ shift
+ ls --color -vt "$@" | head -n 5
+ ;;
+ size)
+ shift
+ ls --color -vS "$@"
+ ;;
+ all)
+ shift
+ ls --color -vlha "$@"
+ ;;
+ extension)
+ shift
+ ls --color -vX "$@"
+ ;;
+ *)
+ ls --color -v "$@"
+ ;;
+ esac
+}
+alias ll='ls -lha'
+alias halt='sudo halt'
+alias reboot='sudo reboot'
+alias hibernate='sudo pm-hibernate'
+alias grep='ack-grep -i'
+alias diff='diff -u'
+alias less='less -r'
+alias ec='emacsclient'
+alias ecr='emacsclient -n -c'
+alias et='emacsclient -t'
+alias fetch='git fetch'
+
+# apt aliases
+alias au='sudo aptitude update'
+alias aup='sudo aptitude safe-upgrade'
+alias ai='sudo aptitude install'
+alias as='aptitude search'
+alias ashow='aptitude show'
+alias arp='sudo aptitude purge'
+alias dl='dpkg -l | grep'
+alias dL='dpkg -L'
+
+# tiny helpers
+alias rmdup='find . -name "*\ \(1\)*" -exec rm {} \;'
+alias entertain='vlc "$(find . -type f -regextype posix-awk -iregex ".*\.(avi|mpg|mpeg|mkv|wmv|dat)$" | sort --random-sort | head -n 1)"'
+alias sprunge='curl -F "sprunge=<-" http://sprunge.us'
+alias xrandr-restore='xrandr --output CRT1 --auto; xrandr --output CRT2 --auto; xrandr --output CRT2 --left-of CRT1'
+alias incognito='export HISTFILE=/dev/null'
+alias git-prove='make -j 8 DEFAULT_TEST_TARGET=prove GIT_PROVE_OPTS="-j 15" test'
+
+# suffix aliases
+alias -s html=x-www-browser
+alias -s org=$EDITOR
+alias -s c=$EDITOR
+alias -s cc=$EDITOR
+alias -s hs=$EDITOR
+alias -s pdf=evince
+alias -s djvu=evince
+alias -s avi=vlc
+alias -s mpg=vlc
+alias -s mpeg=vlc
+alias -s mkv=vlc
+alias -s wmv=vlc
+alias -s dat=vlc
+alias -s mp3=mpg321
+
+# ---[ ZSH Options ]----------------------------------------------------
+setopt NO_GLOBAL_RCS NO_FLOW_CONTROL NO_BEEP MULTIOS
+setopt AUTO_LIST NO_LIST_AMBIGUOUS MENU_COMPLETE AUTO_REMOVE_SLASH
+setopt LIST_PACKED LIST_TYPES
+setopt INC_APPEND_HISTORY EXTENDED_HISTORY SHARE_HISTORY HIST_REDUCE_BLANKS
+setopt HIST_SAVE_NO_DUPS HIST_IGNORE_DUPS HIST_FIND_NO_DUPS HIST_EXPIRE_DUPS_FIRST
+setopt NO_NOTIFY LONG_LIST_JOBS
+setopt AUTO_CD AUTO_PUSHD PUSHD_SILENT
+
+# ---[ History ]-------------------------------------------------------
+HISTFILE=~/.zsh-history
+HISTSIZE=30000
+SAVEHIST=$HISTSIZE
+# Save history across sessions and terminals
+setopt append_history
+
+# ---[ Completition system ]-------------------------------------------
+zstyle ':completion:*' use-cache on
+zstyle ':completion:*' cache-path ~/.zsh/cache
+zstyle ':completion:*' completer _complete _match _approximate
+zstyle ':completion:*' matcher-list '+' '+m:{|:lower:|}={|:upper:|}' '+l:|=* r:|=*' '+r:|[._-]=** r:|=**'
+zstyle ':completion:*' list-colors no=00 fi=00 di=01\;34 pi=33 so=01\;35 bd=00\;35 cd=00\;34 or=00\;41 mi=00\;45 ex=01\;32
+zstyle ':completion:*' verbose yes
+zstyle ':completion:*' insert-tab false
+zstyle ':completion:*:*:git:*' verbose no
+zstyle ':completion:*:files' ignored-patterns '*?.o' '*?~'
+zstyle ':completion:*:files' file-sort 'date'
+zstyle ':completion:*:default' list-prompt
+zstyle ':completion:*:match:*' original only
+zstyle -e ':completion:*:approximate:*' max-errors 'reply=( $(( ($#PREFIX + $#SUFFIX) / 5 )) )'
+zstyle ':completion:*:functions' ignored-patterns '_*'
+
+# ---[ ZLE ]------------------------------------------------------------
+history-incremental-search-backward-initial() {
+ zle history-incremental-search-backward $BUFFER
+}
+zle -N history-incremental-search-backward-initial
+bindkey '^R' history-incremental-search-backward-initial
+bindkey -M isearch '^R' history-incremental-search-backward
+
+# ---[ System settings ]------------------------------------------------
+limit -s coredumpsize 0
+umask 0027
Oops, something went wrong.

0 comments on commit ed176da

Please sign in to comment.