-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.bash_aliases
77 lines (59 loc) · 1.87 KB
/
.bash_aliases
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
export PATH=~/bin:$PATH
export EDITOR=vim
alias repoclean='sudo echo "Cleaning with 8 threads"; repo forall -j8 -p -c sudo git clean -xqdf'
. /etc/bash_completion.d/git-prompt
if [ $(hostname) != "$WORKING_COMPUTER" ]
then
DISPLAY_HOSTNAME="\[$(tput setaf 6)\]$(hostname) \[$(tput sgr0)\]"
fi
# Custom bash prompt via kirsle.net/wizards/ps1.html
export PS1="[$DISPLAY_HOSTNAME\w]\[$(tput setaf 2)\]\$(__git_ps1 \" (%s)\")\[$(tput sgr0)\]\\$\[$(tput sgr0)\] "
# Create a global log of all git commits.
git()
{
if [[ $1 == "commit" ]]; then
command git "$@"
rc=$?
if [[ $rc == 0 ]]; then
# Success, add it to the global commit log
# TODO: respect git's -C option
echo "Commit to $(git rev-parse --show-toplevel) on $(date):" >> ~/.gitcommitlog
cat $(git rev-parse --git-dir)/COMMIT_EDITMSG >> ~/.gitcommitlog
fi
else
command git "$@"
fi
}
alias tmux="tmux -2"
export PATH=$PATH:$GOPATH/bin
# unlimited bash history
export HISTSIZE=""
shopt -s histappend
HISTTIMEFORMAT='%F %T '
#set -o vi
#bind -m vi-command ".":insert-last-argument
## This needs to be split back out
SSH_ENV="$HOME/.ssh/environment"
function start_agent {
echo "Initialising new SSH agent..."
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
echo succeeded
chmod 600 "${SSH_ENV}"
. "${SSH_ENV}" > /dev/null
/usr/bin/ssh-add;
}
# Source SSH settings, if applicable
if [ -f "${SSH_ENV}" ]; then
. "${SSH_ENV}" > /dev/null
#ps ${SSH_AGENT_PID} doesn't work under cywgin
ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
start_agent;
}
else
start_agent;
fi
alias grep=rg
export FZF_DEFAULT_COMMAND='rg --files --no-ignore --hidden --follow -g "!{.git,node_modules}/*" 2> /dev/null'
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
bind -x '"\C-p": vim $(fzf);'
export FZF_TMUX=1