forked from mjcarroll/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.bashrc
78 lines (63 loc) · 1.72 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
#!/bin/bash
: ${HOME=~}
: ${LOGNAME=$(id -un)}
: ${UNAME=$(uname)}
: ${HOSTFILE=~/.ssh/known_hosts}
: ${INPUTRC=~/.inputrc}
bash_start_time=$(date +%s)
bash_uptime() {
echo "$(($(date +%s)-${bash_start_time})) seconds"
}
log() {
[ ! -z "$PS1" ] \
&& echo -n ""
return 0
}
export VIRTUAL_ENV_DISABLE_PROMPT=1
if [ $UID != 0 ]; then
# Pip download cache
mkdir -p "${HOME}/.cache/pip_download" \
&& export PIP_DOWNLOAD_CACHE="${HOME}/.cache/pip_download"
fi
[ -z "$PS1" ] \
&& return
[ $(which stty) ] \
&& stty -ixon
# Read all the interesting bits from sub-files.
shopt -s nullglob
for file in "$HOME/.bash_profile.d"/*.sh; do
log "$file"
source "$file"
done
shopt -u nullglob
# Prompt
ps1_set --prompt ∫ --notime 'S\:\ '
# And Title Bar
case "$TERM" in
xterm*|rxvt*)
PROMPT_COMMAND='echo -ne "\033]0;urxvt:${PWD/$HOME/~}\007"'
;;
*)
;;
esac
[ -e "${HOME}/.sshrc" ] \
&& . "${HOME}/.sshrc"
# Private and Local
[ -e "${HOME}/.bashrc-private" ] \
&& . "${HOME}/.bashrc-private" \
&& log "loaded .bashrc-private"
[ -e "${HOME}/.bashrc-local" ] \
&& . "${HOME}/.bashrc-local" \
&& log "loaded .bashrc-local"
# ROS
[ -e "${HOME}/.rosrc" ] \
&& . "${HOME}/.rosrc" \
&& log "loaded .rosrc"
# clipboard paste
if [ -n "$DISPLAY" ] && [ -x /usr/bin/xclip ] ; then
# Work around a bash bug: \C-@ does not work in a key binding
bind '"\C-x\C-m": set-mark'
# The '#' characters ensure that kill commands have text to work on; if
# not, this binding would malfunction at the start or end of a line.
bind 'Control-v: "#\C-b\C-k#\C-x\C-?\"$(xclip -out -selection clipboard)\"\e\C-e\C-x\C-m\C-a\C-y\C-?\C-e\C-y\ey\C-x\C-x\C-d"'
fi