forked from startup-class/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.bashrc
92 lines (77 loc) · 2.39 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
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# Nice-to-have interactive commands
alias ggl="git checkout -- Gemfile*.lock"
# Save a very long command history, ignore lines starting with space, append immediate
export HISTFILESIZE=1000000
export HISTSIZE=1000000
export HISTCONTROL=ignoreboth
shopt -s histappend
PROMPT_COMMAND="history -a;history -c;history -r;$PROMPT_COMMAND"
# Nice output
export CLICOLOR=1
alias ls='ls --color=always'
alias grep='grep --color=always'
export PAGER='less -RS'
if [ -t 1 ]; then
bind 'set completion-ignore-case On'
fi
# tmuxr
# tmux-reattach - looks to see if session is running and attaches if it is, else creates new with that name
function tmuxr {
if [ "$1" ]; then
if [[ -z $( tmux list-sessions -F '#{session_name}' 2>/dev/null | grep $1 ) ]]; then
tmux_new_session $*
else
tmux attach-session -d -t $1;
fi;
else
echo 'Need first argument to be session name';
return 2;
fi
}
# Creates a new tmux session with a given name. First parameter is session name, second parameter
# is an enum specifying a type of session to start. Current values:
function tmux_new_session {
if [ "$1" ]; then
if [ "$2" ]; then
case $2 in
# left as example
[Cc][Pp])
# aws-vault exec prod -- echo CloudPercept session starting;
tmux new -s $1 -n runners -d
# Split first window into four rectangles:
# 0 1
# 2 3
tmux split-window -t "$1:0"
tmux split-window -h -t "$1:0.0"
tmux split-window -h -t "$1:0.2"
# Load up default commands, but don't yet execute:
# shell takes a moment to get prepared
tmux send-keys -t "$1:0.0" 'echo hi'
tmux send-keys -t "$1:0.1" 'echo hi'
tmux send-keys -t "$1:0.2" 'echo hi'
tmux send-keys -t "$1:0.3" 'echo hi'
echo 'Loading shells...'
sleep 1
tmux send-keys -t "$1:0.0" Enter
tmux send-keys -t "$1:0.1" Enter
tmux send-keys -t "$1:0.2" Enter
tmux send-keys -t "$1:0.3" Enter
tmux attach-session -d -t $1;
cd -;
;;
*)
tmux new -s $1
;;
esac
else
tmux new -s $1;
fi
else
echo 'Need first argument to be session name';
return 2;
fi
}
source ~/.bash_git_ps1
[ -f ~/.fzf.bash ] && source ~/.fzf.bash
export EDITOR=vim
alias gbr="git branch | grep '*' | cut -d' ' -f2"