add dotfiles
authorPeng Li <seudut@gmail.com>
Mon, 22 Dec 2014 06:25:08 +0000 (14:25 +0800)
committerPeng Li <seudut@gmail.com>
Mon, 22 Dec 2014 06:25:08 +0000 (14:25 +0800)
README.md [new file with mode: 0644]
aa [deleted file]
bashrc [new file with mode: 0644]
tmux.conf [new file with mode: 0755]
vimperatorrc [new file with mode: 0644]
zshrc [new file with mode: 0644]

diff --git a/README.md b/README.md
new file mode 100644 (file)
index 0000000..bcd0f57
--- /dev/null
+++ b/README.md
@@ -0,0 +1,4 @@
+dotfiles
+========
+
+some backup files for zshrc bashrc tmux.conf etc.
diff --git a/aa b/aa
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/bashrc b/bashrc
new file mode 100644 (file)
index 0000000..bfd0ce2
--- /dev/null
+++ b/bashrc
@@ -0,0 +1,75 @@
+#!/bin/bash
+
+
+function parse_git_dirty {
+  [[ $(git status 2> /dev/null | tail -n1) != "nothing to commit, working directory clean" ]] && echo "*"
+  }
+  function parse_git_branch {
+    git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
+}
+##export PS1='\u@\h:\w\[\e[1;36m\]$(parse_git_branch)\[\e[0m\]$ 
+
+
+S1='\[\e[01;32m\]\u@\[\e[00m\]\[\e[01;34m\][\w]\[\e[00m\] >> '
+export PS1
+
+alias l='ls -CF';
+alias ll='ls -l';
+alias la='ls -a';
+
+alias grep='grep --color'
+
+man() {
+       env \
+               GROFF_NO_SGR=$(printf "1")      \
+               LESS_TERMCAP_mb=$(printf "\e[1;31m") \
+               LESS_TERMCAP_md=$(printf "\e[1;31m") \
+               LESS_TERMCAP_me=$(printf "\e[0m") \
+               LESS_TERMCAP_se=$(printf "\e[0m") \
+               LESS_TERMCAP_so=$(printf "\e[1;44;33m") \
+               LESS_TERMCAP_ue=$(printf "\e[0m") \
+               LESS_TERMCAP_us=$(printf "\e[1;32m") \
+                       man "$@"
+}
+
+md ()  {       mkdir -p "$1"   &&      cd "$1";        }
+
+# ECC android environment setup
+# http://gwydlvm207.cisco.com/wiki/doku.php?id=enhancedcallcontrolapi:android_dev_env_setup&s[]=mac&s[]=setup
+
+export PYTHONPATH="/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/"
+export DEV_ENV_ROOT=$HOME/android/
+export ANDROID_NDK_ROOT="${DEV_ENV_ROOT}/android-ndk-r8c/"
+export ANDROID_SDK_ROOT="${DEV_ENV_ROOT}/android-sdk-macosx/"
+#export ANDROID_TOOLCHAIN="${DEV_ENV_ROOT}/standalone-toolchain-api14/"
+export ANDROID_NDK_HOME="$HOME/android/android-ndk-r8c"
+
+
+
+export ANDROID_TOOLCHAIN="$ANDROID_NDK_HOME/standalone-toolchain-api14/"
+
+
+export ANDROID_HOME="/Users/peli3/android/android-sdk-macosx/"
+
+export PATH=$PATH:"${ANDROID_TOOLCHAIN}/bin/":"${ANDROID_HOME}/platform-tools/"
+export PATH="$HOME/bin":$PATH
+
+
+
+pathadd () {   export PATH="$1":$PATH; }
+
+dgrep () {     find "$2" \( -iname '*.cpp' -or -iname '*.hpp' -or -iname '*.c' -or -iname '*.h' \) -exec grep -Hn --color "$1" {} \;   ;}
+
+alias mvim='mvim --remote-silent';
+
+diff () { diff "$@"    ;       }
+#export PYTHONPATH=/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/
+
+if [ -f "/Users/peli3/.git-completion.bash" ]; then
+       . "/Users/peli3/.git-completion.bash"
+fi
+
+## https://linuxtoy.org/archives/bash_tricks.html
+#shopt -s histappend 
+#PROMPT_COMMAND='history -a'
+#
diff --git a/tmux.conf b/tmux.conf
new file mode 100755 (executable)
index 0000000..431e0b2
--- /dev/null
+++ b/tmux.conf
@@ -0,0 +1,126 @@
+#set -g prefix ^O
+#unbind ^b
+#bind o        send-prefix
+unbind-key C-b
+set -g prefix 'C-\'
+bind-key 'C-\' send-prefix
+
+set -g         status-fg  white
+#set -g        status-bg  blue
+set -g         status-bg black 
+set-window-option -g  window-status-current-bg red
+#set-option -g  status-right "#[fg=green]#T  #[fg=yellow,bold]#(date '+%Y-%m-%d %I:%M%P %a') "
+#set-option -g  status-right "#[fg=green]#(whoami)  #[fg=yellow,bold]#(date '+%Y-%m-%d') #[fg=red,bold]#(date '+%I:%M') #[fg=yellow,bold]#(date '+%p %a') "
+set-option -g  status-right "#[fg=yellow]#(date '+%Y-%m-%d') #[fg=red]#(date '+%I:%M') #[fg=yellow]#(date '+%p %a') "
+
+## automatic change the window title 
+#set-option -g set-titles      on
+#set-option -g set-titles-string       '#T'
+#set-option -g set-titles-string       "#(date '+%I:%M %P %a')"
+#set-window-option -g  automatic-rename        on
+set-option -g allow-rename off
+
+
+#http://unix.stackexchange.com/questions/12032/create-new-window-with-current-directory-in-tmux
+bind-key -n  "M-t"     new-window #-c '#{pane_current_path}'
+bind-key -n  "M-n"     next-window
+bind-key -n  "M-p"     previous-window
+bind-key -n  "M-Space" last-window
+
+
+bind-key -n  "M-`"     select-window -t:0
+bind-key -n  "M-1"     select-window -t:1
+bind-key -n  "M-2"     select-window -t:2
+bind-key -n  "M-3"     select-window -t:3
+bind-key -n  "M-4"     select-window -t:4
+bind-key -n  "M-5"     select-window -t:5
+bind-key -n  "M-6"     select-window -t:6
+bind-key -n  "M-7"     select-window -t:7
+bind-key -n  "M-8"     select-window -t:8
+bind-key -n  "M-9"     select-window -t:9
+
+#bind-key -n  "C-M-h"  split-window -h
+#bind-key -n  "C-M-v"  split-window -v
+bind-key -n  "M-v"             split-window -h -c '#{pane_current_path}'
+bind-key -n  "M-s"             split-window -v -c '#{pane_current_path}'
+
+##bind-key   "o"               select-pane -l
+##bind-key   "j"               select-pane -D
+##bind-key   "k"               select-pane -U
+##bind-key   "h"               select-pane -R
+##bind-key   "l"               select-pane -L
+
+bind-key   "C-h"               resize-pane -L 3
+bind-key   "C-j"               resize-pane -D 3
+bind-key   "C-k"               resize-pane -U 3
+bind-key   "C-l"               resize-pane -R 3
+
+bind-key -n    "M-j"   select-pane     -D
+bind-key -n    "M-k"   select-pane     -U
+bind-key -n    "M-l"   select-pane     -R
+bind-key -n    "M-h"   select-pane     -L
+#bind-key -n   "M-o"   select-pane     -l
+
+set-option     -g      mode-keys vi
+
+set-window-option      -g      utf8 on
+
+bind-key -n "M-i" copy-mode 
+
+
+# refer http://askubuntu.com/questions/350718/problem-regarding-tmux-copy-mode
+# $ tmux list-keys -t vi-copy
+bind-key -t vi-copy "v" begin-selection
+bind-key -t vi-copy "Space" page-down
+bind-key -t vi-copy "BSpace" page-up
+bind-key -t vi-copy "y"        copy-selection  
+bind-key -t vi-copy "K" halfpage-up
+bind-key -t vi-copy "J" halfpage-down
+#http://unix.stackexchange.com/questions/15715/getting-tmux-to-copy-a-buffer-to-the-clipboard
+bind -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
+### mouse enable
+# Reload tmux config
+#bind r source-file ~/.tmux.conf
+bind r source-file ~/.tmux.conf \; display "Reloaded!"
+#set-option    -g      mouse-select-window  on
+#set-option    -g      mouse-select-pane       on
+#set-option    -g      mouse-resize-pane       on
+#set-option    -g      mouse-utf8      on
+
+#set-window-option     -g      mode-mouse      on
+
+#set -g default-terminal "screen-256color"
+
+## macvim starting from tmux does't have "+ register, cannot using command+v to paste
+# https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard/blob/master/Usage.md
+# http://stackoverflow.com/questions/16618992/cant-paste-into-macvim
+# set-option -g default-command 'reattach-to-user-namespace -l "$SHELL"'
+set-option -g default-command 'command -v reattach-to-user-namespace >/dev/null && exec reattach-to-user-namespace -l "$SHELL" || exec "$SHELL"'
+
+
+
+#set-option -g pane-border-fg colour235 #base02
+#    set-option -g pane-active-border-fg colour240 #base01
+#set -g status-justify centre
+#setw -g monitor-activity on
+#    set -g visual-activity on
+
+
+#      set-window-option -g window-status-fg brightblue #base0
+#    set-window-option -g window-status-bg colour236 
+#    set-window-option -g window-status-attr dim
+
+#    set-window-option -g window-status-current-fg brightred #orange
+#    set-window-option -g window-status-current-bg colour236 
+#    set-window-option -g window-status-current-attr bright
+
+set-option -g base-index 1
+setw -g pane-base-index 1
+set-option -sg escape-time 0
+
+#http://www.tylercipriani.com/2013/09/12/important-lines-in-my-tmux.html
+#bind-key -n "M-\\" resize-pane -Z #\; display-message "Zoom zoom zoom"
+bind-key -n "M-o" resize-pane -Z #\; display-message "Zoom zoom zoom"
+
+set -g renumber-windows on
+set-option -g history-limit 10000
diff --git a/vimperatorrc b/vimperatorrc
new file mode 100644 (file)
index 0000000..82667dc
--- /dev/null
@@ -0,0 +1,48 @@
+"3.8.2 (created: 2014/02/13 23:52:43)
+
+cd ~
+
+set tabnumbers
+let mapleader = ','
+
+cmap <C-p> <Up>
+cmap <C-n> <Down>
+cmap <C-h> <BS>
+cmap <C-[> <Esc>
+
+nnoremap j 6j
+nnoremap k 6k
+nnoremap h gT
+nnoremap l gt
+nnoremap <C-h> h
+nnoremap <C-j> j
+nnoremap <C-k> k
+nnoremap <C-l> l
+
+nmap <BS> <PageUp>
+nmap J <C-d>
+nmap K <C-u>
+
+
+nmap <Leader>h :help<Space>
+"nmap <Leader>b        :bmarks! -tags<Space>
+
+
+
+nmap <Leader>, :source ~/.vimperatorrc<CR>
+
+
+noremap <C-o>  <Esc>
+
+
+set "editor=/usr/local/bin/mvim --remote-silent"
+source! .vimperatorrc.local
+
+" vim: set ft=vimperator:
+
+imap <S-BS>    <C-w>
+cmap <S-BS>    <C-w>
+cmap jj        <Esc>   
+
+nnoremap B b
+nnoremap b :bmarks! -tags<SPACE>
diff --git a/zshrc b/zshrc
new file mode 100644 (file)
index 0000000..b7f253b
--- /dev/null
+++ b/zshrc
@@ -0,0 +1,207 @@
+
+autoload colors
+colors
+
+for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
+eval _$color='%{$terminfo[bold]$fg[${(L)color}]%}'
+eval $color='%{$fg[${(L)color}]%}'
+(( count = $count + 1 ))
+done
+
+
+# right prompt
+#RPROMPT=$(echo "$RED%D %T$FINISH")
+#PROMPT=$(echo "$CYAN%n[$BLUE%~]$_YELLOW>>$FINISH ")
+PROMPT=$(echo "%B$CYAN%n$_YELLOW@$BLUE%<<[%~%<<]$_YELLOW>> $WHITE%b")
+
+export HISTSIZE=10000
+export SAVEHIST=10000
+export HISTFILE="$HOME/.zsh_history"
+setopt INC_APPEND_HISTORY
+setopt HIST_IGNORE_DUPS
+setopt EXTENDED_HISTORY
+
+setopt AUTO_PUSHD      
+setopt HIST_IGNORE_SPACE
+
+
+
+export CLICOLOR=1
+export LSCOLORS=ExFxCxDxBxegedabagaced
+
+       
+
+man() {
+       env \
+               GROFF_NO_SGR=$(printf "1")      \
+               LESS_TERMCAP_mb=$(printf "\e[1;31m") \
+               LESS_TERMCAP_md=$(printf "\e[1;31m") \
+               LESS_TERMCAP_me=$(printf "\e[0m") \
+               LESS_TERMCAP_se=$(printf "\e[0m") \
+               LESS_TERMCAP_so=$(printf "\e[1;44;33m") \
+               LESS_TERMCAP_ue=$(printf "\e[0m") \
+               LESS_TERMCAP_us=$(printf "\e[1;32m") \
+                       man "$@"
+}
+
+
+export PYTHONPATH="/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/"
+export DEV_ENV_ROOT=$HOME/android/
+export ANDROID_NDK_ROOT="${DEV_ENV_ROOT}/android-ndk-r8c/"
+export ANDROID_SDK_ROOT="${DEV_ENV_ROOT}/android-sdk-macosx/"
+#export ANDROID_TOOLCHAIN="${DEV_ENV_ROOT}/standalone-toolchain-api14/"
+export ANDROID_NDK_HOME="$HOME/android/android-ndk-r8c"
+
+
+
+export ANDROID_TOOLCHAIN="$ANDROID_NDK_HOME/standalone-toolchain-api14/"
+
+
+export ANDROID_HOME="/Users/peli3/android/android-sdk-macosx/"
+
+export PATH=$PATH:"${ANDROID_TOOLCHAIN}/bin/":"${ANDROID_HOME}/platform-tools/"
+export PATH="$HOME/bin":"/usr/local/bin":$PATH
+
+###====================
+#
+#autoload -U compinit
+#compinit
+#zstyle ':completion:*:descriptions' format '%U%B%d%b%u'
+#zstyle ':completion:*:warnings' format '%BSorry, no matches for: %d%b'
+#
+#
+######################## zsh alias #########################
+
+alias grep='grep --color -E'
+alias mvim='mvim --remote-silent'
+alias vim='/usr/local/bin/mvim -v'
+alias tmux='tmux -2'
+
+alias l='ls -l'
+alias ll='ls -l'
+alias la='ls -a'
+
+alias diff='colordiff'
+
+alias mv='mv -i'
+alias cp='cp -i'
+alias ln='ln -i'
+
+#alias svn='colorsvn'
+alias sed='/usr/local/bin/gsed'
+
+
+
+###########################  zsh completion ##########################
+#
+#autoload -U compinit
+#compinit
+
+#zstyle ':completion:*:descriptions' format '%U%B%d%b%u'
+#zstyle ':completion:*:warnings' format '%BSorry, no matches for: %d%b'
+#
+#autoload -U compinit
+#compinit
+#
+#autoload -U promptinit
+#promptinit
+#
+#setopt correctall
+#
+#
+zstyle ':completion:*' menu select
+setopt AUTOLIST
+setopt AUTOMENU
+
+
+autoload -U compinit
+compinit
+
+
+WORDCHARS='*?_-[]~=&;!#$%^(){}<>'
+
+
+################
+#
+#http://techanic.net/2012/12/30/my_git_prompt_for_zsh.html
+# Adapted from code found at <https://gist.github.com/1712320>.
+
+setopt prompt_subst
+autoload -U colors && colors # Enable colors in prompt
+
+# Modify the colors and symbols in these variables as desired.
+GIT_PROMPT_SYMBOL="%{$fg[blue]%}±"
+GIT_PROMPT_PREFIX="%{$fg[green]%}[%{$reset_color%}"
+GIT_PROMPT_SUFFIX="%{$fg[green]%}]%{$reset_color%}"
+GIT_PROMPT_AHEAD="%{$fg[red]%}ANUM%{$reset_color%}"
+GIT_PROMPT_BEHIND="%{$fg[cyan]%}BNUM%{$reset_color%}"
+GIT_PROMPT_MERGING="%{$fg_bold[magenta]%}⚡︎%{$reset_color%}"
+GIT_PROMPT_UNTRACKED="%{$fg_bold[red]%}●%{$reset_color%}"
+GIT_PROMPT_MODIFIED="%{$fg_bold[yellow]%}●%{$reset_color%}"
+GIT_PROMPT_STAGED="%{$fg_bold[green]%}●%{$reset_color%}"
+
+# Show Git branch/tag, or name-rev if on detached head
+parse_git_branch() {
+  (git symbolic-ref -q HEAD || git name-rev --name-only --no-undefined --always HEAD) 2> /dev/null
+}
+
+# Show different symbols as appropriate for various Git repository states
+parse_git_state() {
+
+  # Compose this value via multiple conditional appends.
+  local GIT_STATE=""
+
+  local NUM_AHEAD="$(git log --oneline @{u}.. 2> /dev/null | wc -l | tr -d ' ')"
+  if [ "$NUM_AHEAD" -gt 0 ]; then
+    GIT_STATE=$GIT_STATE${GIT_PROMPT_AHEAD//NUM/$NUM_AHEAD}
+  fi
+
+  local NUM_BEHIND="$(git log --oneline ..@{u} 2> /dev/null | wc -l | tr -d ' ')"
+  if [ "$NUM_BEHIND" -gt 0 ]; then
+    GIT_STATE=$GIT_STATE${GIT_PROMPT_BEHIND//NUM/$NUM_BEHIND}
+  fi
+
+  local GIT_DIR="$(git rev-parse --git-dir 2> /dev/null)"
+  if [ -n $GIT_DIR ] && test -r $GIT_DIR/MERGE_HEAD; then
+    GIT_STATE=$GIT_STATE$GIT_PROMPT_MERGING
+  fi
+
+  if [[ -n $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then
+    GIT_STATE=$GIT_STATE$GIT_PROMPT_UNTRACKED
+  fi
+
+  if ! git diff --quiet 2> /dev/null; then
+    GIT_STATE=$GIT_STATE$GIT_PROMPT_MODIFIED
+  fi
+
+  if ! git diff --cached --quiet 2> /dev/null; then
+    GIT_STATE=$GIT_STATE$GIT_PROMPT_STAGED
+  fi
+
+  if [[ -n $GIT_STATE ]]; then
+    echo "$GIT_PROMPT_PREFIX$GIT_STATE$GIT_PROMPT_SUFFIX"
+  fi
+
+}
+
+# If inside a Git repository, print its branch and state
+git_prompt_string() {
+  local git_where="$(parse_git_branch)"
+  [ -n "$git_where" ] && echo "$GIT_PROMPT_SYMBOL$(parse_git_state)$GIT_PROMPT_PREFIX%{$fg[yellow]%}${git_where#(refs/heads/|tags/)}$GIT_PROMPT_SUFFIX"
+}
+
+# Set the right-hand prompt
+RPS1='$(git_prompt_string)'
+
+#source ~/Private/zsh-syntax-highlighting/zsh-syntax-highlighting.plugin.zsh
+source ~/Private/zsh_plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
+# http://stackoverflow.com/questions/3483604/which-shortcut-in-zsh-does-the-same-as-ctrl-u-in-bash
+bindkey \^U backward-kill-line
+
+export PYTHONSTARTUP="$HOME/.pythonrc"
+
+source $HOME/.cpverc
+source $HOME/.eccrc
+
+#` git log --oneline --abbrev-commit --all --graph --decorate --color `
+[[ -s `brew --prefix`/etc/autojump.sh ]] && . `brew --prefix`/etc/autojump.sh