-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.bashrc
62 lines (45 loc) · 1.27 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
#!/bin/bash
# If not running interactively, don't do anything.
case $- in
*i*) ;;
*) return;;
esac
# Load aliass if exists
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
# Load variables if exists
if [ -f ~/.bash_colors ]; then
. ~/.bash_colors
fi
# Configure Bash History
# Don't put duplicate lines or lines starting with space in
# the history (~/.bash_history).
HISTCONTROL=ignoreboth
# Append to the history file, don't overwrite it.
shopt -s histappend
# Setting history size.
HISTSIZE=100
HISTFILESIZE=200
# Configure Bash Behavior
# Check the window size after each command and, if
# necessary, update the values of LINES and COLUMNS.
shopt -s checkwinsize
# Make the pattern "**" in a pathname expansion context
# match all files and zero or more directories.
if [ "$OSTYPE" == linux-gnu ]; then
shopt -s globstar;
fi
# Configure Prompt Style
# Lookup for git branch.
function PS1_GIT_BRANCH() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
# Set different color for root.
PS1_USER_COLOR="\e[31m"
if [ "$EUID" -ne 0 ]; then
PS1_USER_COLOR="\e[32m"
fi
# Set the promt variable.
export PS1="\[$PS1_USER_COLOR\]\u@\h \[\e[${LIGHT_YELLOW_FG}m\]\w \[\e[${LIGHT_CYAN_FG}m\]\$(PS1_GIT_BRANCH)
\[\e[${WHITE_FG}m\]\$ \[\e[m\] "