-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.bashrc
124 lines (103 loc) · 3.3 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
export PATH="/usr/local/bin:"$PATH
# add virtualenv support
export WORKON_HOME=$HOME/.virtualenvs
export VIRTUALENVWRAPPER_SCRIPT=/usr/local/bin/virtualenvwrapper.sh
source /usr/local/bin/virtualenvwrapper_lazy.sh
export HOST=`hostname`
# Everyone needs a little color in their lives
RED='\[\033[31m\]'
GREEN='\[\033[32m\]'
YELLOW='\[\033[33m\]'
BLUE='\[\033[34m\]'
PURPLE='\[\033[35m\]'
CYAN='\[\033[36m\]'
WHITE='\[\033[37m\]'
GRAY="\[\033[1;30m\]"
NIL='\[\033[00m\]'
man() {
env LESS_TERMCAP_mb=$'\E[01;31m' \
LESS_TERMCAP_md=$'\E[01;38;5;74m' \
LESS_TERMCAP_me=$'\E[0m' \
LESS_TERMCAP_se=$'\E[0m' \
LESS_TERMCAP_so=$'\E[38;5;246m' \
LESS_TERMCAP_ue=$'\E[0m' \
LESS_TERMCAP_us=$'\E[04;38;5;146m' \
man "$@"
}
# Hostname styles
FULL='\H'
SHORT='\h'
# System => color/hostname map:
# UC: username color
# LC: location/cwd color
# HD: hostname display (\h vs \H)
# Defaults:
UC=$GREEN
LC=$WHITE
HD=$FULL
# Prompt function because PROMPT_COMMAND is awesome
function set_prompt() {
# show the host only and be done with it.
host="${UC}${HD}${NIL}"
_dirname='$(p="${PWD#${HOME}}"; [ "${PWD}" != "${p}" ] && printf "~";IFS=/; for q in ${p:1}; do printf /${q:0:1}; done; printf "${q:1}")'
path="${LC}${_dirname}${NIL}"
myuser="${UC}\u@${NIL}"
myuser=""
_branch=$(git symbolic-ref HEAD 2>/dev/null)
_branch=${_branch#refs/heads/} # apparently faster than sed
branch="" # need this to clear it when we leave a repo
if [[ -n $_branch ]]; then
branch=" ${NIL}[${YELLOW}${_branch}${NIL}]"
fi
# Dollar/pound sign
end="${LC}\n\$${NIL} "
# Virtual Env
if [[ $VIRTUAL_ENV != "" ]]
then
venv=" ${NIL}(${GREEN}${VIRTUAL_ENV##*/}${NIL})"
else
venv=''
fi
promptz="${host}:"
promptz+="${myuser}"
promptz+="${path}"
promptz+="${venv}"
promptz+="${branch}"
promptz+=" ${end}"
export PS1="${promptz}"
}
export PROMPT_COMMAND=set_prompt
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
. /etc/bash_completion
fi
export CLICOLOR=1
eval $(dircolors -b $HOME/.dircolors)
# wp cli tab completion.
source ~/.bash/wp-completion.bash