-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbashrcaddon
57 lines (44 loc) · 1.24 KB
/
bashrcaddon
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
function docker-ps() {
docker ps -a --format "table {{ .Names }}\\t{{ .Status }}\\t{{ .Ports }}"
}
function docker-enter() {
CONTAINERS_=`docker-ps | grep $1 | awk '{ print $1 }'`
if [ $(echo -n $CONTAINERS_ | wc -w) -eq 1 ]; then
docker exec -ti $CONTAINERS_ bash
else
docker-ps
fi
}
alias vim="nvim"
alias vi="nvim"
RESET=$(tput sgr0)
BLUE=$(tput setaf 4)
GREY=$(tput setaf 244)
RED=$(tput setaf 1)
GREEN=$(tput setaf 2)
YELLOW=$(tput setaf 3)
git_prompt() {
GIT_PROMPT=""
BRANCH=$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/*\(.*\)/\1/')
if [ ! -z $BRANCH ]; then
GIT_PROMPT="\[$YELLOW\]$BRANCH"
if [ ! -z "$(git status --short)" ]; then
GIT_PROMPT="${GIT_PROMPT} \[${RED}\]✗"
else
GIT_PROMPT="${GIT_PROMPT} \[${GREEN}\]✓"
fi
fi
# python virtualenv prompt
VE_PROMPT=""
if [ ! -z $VIRTUAL_ENV ]; then
VE_PROMPT="(\[\$GREEN\]$(basename $VIRTUAL_ENV)\[$RESET\]) "
fi
PS1="${VE_PROMPT}\u:\[$BLUE\]\w${GIT_PROMPT} \[$GREY\]$ \[$RESET\]"
}
PROMPT_COMMAND=git_prompt
export TERM=xterm-256color
PATH=$PATH:~/.local/bin
# Nice tools for python virtualenvs.
source ~/.local/bin/virtualenvwrapper.sh
# Disable ^D, but 11th time will actually cause exit.
set -o ignoreeof