Skip to content

Instantly share code, notes, and snippets.

@xiocode
Created June 25, 2015 02:53
Show Gist options
  • Save xiocode/c9e47eafe11ed4f4cedb to your computer and use it in GitHub Desktop.
Save xiocode/c9e47eafe11ed4f4cedb to your computer and use it in GitHub Desktop.
######################################
#每个目录使用独立的历史纪录{{{
cd() {
builtin cd "$@" # do actual cd
fc -W # write current history file
local HISTDIR="$HOME/.zsh_history$PWD" # use nested folders for history
if [ ! -d "$HISTDIR" ] ; then # create folder if needed
mkdir -p "$HISTDIR"
fi
export HISTFILE="$HISTDIR/zhistory" # set new history file
touch $HISTFILE
local ohistsize=$HISTSIZE
HISTSIZE=0 # Discard previous dir's history
HISTSIZE=$ohistsize # Prepare for new dir's history
fc -R #read from current histfile
}
mkdir -p $HOME/.zsh_history$PWD
export HISTFILE="$HOME/.zsh_history$PWD/zhistory"
#
function allhistory { cat $(find $HOME/.zsh_history -name zhistory) }
function convhistory {
sort $1 | uniq |
sed 's/^:\([ 0-9]*\):[0-9]*;\(.*\)/\1::::::\2/' |
awk -F"::::::" '{ $1=strftime("%Y-%m-%d %T",$1) "|"; print }'
}
# #使用 histall 命令查看全部历史纪录
function histall { convhistory =(allhistory) |
sed '/^.\{20\} *cd/i\\' }
# #使用 hist 查看当前目录历史纪录
function hist { convhistory $HISTFILE }
#
# #全部历史纪录 top50
function top50 { allhistory | awk -F':[ 0-9]*:[0-9]*;' '{ $1="" ; print }' | sed 's/ /\n/g' | sed '/^$/d' | sort | uniq -c | sort -nr | head -n 50 }
#
# #}}}
###################XIO##################
[[ -s `brew --prefix`/etc/autojump.sh ]] && . `brew --prefix`/etc/autojump.sh
eval "$(hub alias -s)"
export DOCKER_HOST=tcp://192.168.59.103:2376
export DOCKER_CERT_PATH=/Users/shao/.boot2docker/certs/boot2docker-vm
export DOCKER_TLS_VERIFY=1
# export DOCKER_HOST=tcp://192.168.59.103:2375
# unset DOCKER_CERT_PATH
# unset DOCKER_TLS_VERIFY
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export GOROOT=/Users/shao/Developer/go
export GOPATH=/Users/shao/Developer/workspace
export PATH=/usr/local/bin:/usr/local/sbin:$PATH
export PATH=$GOROOT/bin:$GOPATH/bin:$PATH
export TERM=xterm-256color
######################################
export ANDROID_HOME=`brew --prefix android`
export JAVA_HOME=$(/usr/libexec/java_home)
alias updatedb="sudo /usr/libexec/locate.updatedb"
alias gobuilds=$GOPATH/bin/gb
@xiocode
Copy link
Author

xiocode commented Jun 25, 2015

Bundle 'Valloric/YouCompleteMe'
Bundle 'fatih/vim-go'
Bundle 'bling/vim-airline'
Bundle 'tpope/vim-obsession'

@xiocode
Copy link
Author

xiocode commented Jun 25, 2015

" XIO
set ts=4 sts=4 sw=4
"set expandtab
set noexpandtab
let g:ycm_key_list_select_completion=[]
let g:ycm_key_list_previous_completion=[]

" Golang
let g:go_fmt_command = "goimports"
let g:go_highlight_functions = 1
let g:go_highlight_methods = 1
let g:go_highlight_structs = 1

" airline
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment