-
Notifications
You must be signed in to change notification settings - Fork 0
/
.bashrc
38 lines (31 loc) · 1.16 KB
/
.bashrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$PATH:/usr/local/bin
source /usr/local/etc/bash_completion.d/git-prompt.sh
source /usr/local/etc/bash_completion.d/git-completion.bash
GIT_PS1_SHOWDIRTYSTATE=true
export PS1='\h\[\033[00m\]:\W\[\033[31m\]$(__git_ps1 [%s])\[\033[00m\] \360\237\220\244 '
export HISTCONTROL="ignoredups"
peco-history() {
local NUM=$(history | wc -l)
local FIRST=$((-1*(NUM-1)))
if [ $FIRST -eq 0 ] ; then
history -d $((HISTCMD-1))
echo "No history" >&2
return
fi
local CMD=$(fc -l $FIRST | sort -k 2 -k 1nr | uniq -f 1 | sort -nr | sed -E 's/^[0-9]+[[:blank:]]+//' | peco | head -n 1)
if [ -n "$CMD" ] ; then
history -s $CMD
if type osascript > /dev/null 2>&1 ; then
(osascript -e 'tell application "System Events" to keystroke (ASCII character 30)' &)
fi
else
history -d $((HISTCMD-1))
fi
}
bind -x '"\C-r":peco-history'
alias pco='git checkout `git branch | peco`'
alias pssh='ssh $(grep "^Host" ~/.ssh/config|peco|awk "{print \$2}")'
alias pcd='cd $(ghq list -p | peco)'
alias pvi='vi `find . | peco`'
alias pcode='code $(ghq list --full-path | peco)'