-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.bashrc
51 lines (43 loc) · 1.28 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
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
# XON flow control
[[ -x /usr/bin/stty ]] && stty -ixon
# Custom aliases
[[ -f ~/.bash_aliases ]] && source ~/.bash_aliases
# Git prompt
[[ ${GITPROMPT} != 0 ]] && source /usr/share/git/completion/git-prompt.sh
# Colored man pages
man()
{
env \
GROFF_NO_SGR=1 \
LESS_TERMCAP_me=$'\e[0m' \
LESS_TERMCAP_se=$'\e[0m' \
LESS_TERMCAP_ue=$'\e[0m' \
LESS_TERMCAP_mb=$'\e[01;31m' \
LESS_TERMCAP_so=$'\e[38;5;8m' \
LESS_TERMCAP_md=$'\e[01;38;5;12m' \
LESS_TERMCAP_us=$'\e[04;38;5;14m' \
man "$@"
}
# Bash Prompt (PS1)
setPrompt()
{
# Initialize PS1
PS1=''
# Regular colors
local off='\[\e[0m\]'
local red='\[\e[0;31m\]'
local blue='\[\e[0;34m\]'
local cyan='\[\e[0;36m\]'
local green='\[\e[0;32m\]'
local yellow='\[\e[0;33m\]'
local purple='\[\e[0;35m\]'
# Check Git branch
[[ ${GITPROMPT} != 0 ]] && local branch=$(__git_ps1 ":%s")
# Check Python virtual environments
[[ ${VIRTUAL_ENV} != "" ]] && PS1+="${cyan}(${VIRTUAL_ENV##*/})${off} "
# Finalize PS1 (User, Directory, Branch, Prompt symbols: $/#)
PS1+="${blue}\u${off} ${purple}in${off} ${green}\w${off}${cyan}${branch:-}${off} ${yellow}\\\$${off} "
}
PROMPT_COMMAND=setPrompt