-
Notifications
You must be signed in to change notification settings - Fork 0
/
.bashrc
80 lines (64 loc) · 1.97 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
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
# don't put duplicate lines or lines starting with space in the history.
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=2000
HISTFILESIZE=4000
# 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)"
# Base path
export PATH="$HOME/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
# Git branch to display in prompt
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color|*-256color) color_prompt=yes;;
esac
COLOR_RED='\[\033[0;91m\]'
COLOR_GREEN='\[\033[0;92m\]'
COLOR_BLUE='\[\033[0;34m\]'
COLOR_RESET='\[\033[00m\]'
PROMPT_TITLE='\[\e]0;\u@\h: \w\a\]'
if [ "$color_prompt" = yes ]; then
PS1="${PROMPT_TITLE}${COLOR_GREEN}\u${COLOR_RED}@${COLOR_GREEN}\h${COLOR_RESET}: ${COLOR_BLUE}\w${COLOR_RED}\$(parse_git_branch)${COLOR_RESET} \$ "
else
PS1="${PROMPT_TITLE}\u@\h:\w\$(parse_git_branch) \$ "
fi
unset color_prompt
# Set default editor
export EDITOR="vim"
# enable color support of ls
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
fi
# basic aliases
if [ -f ~/.dotfiles/aliases ]; then
. ~/.dotfiles/aliases
fi
# custom aliases
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
# Custom settings
if [ -f ~/.bashrc.mine ]; then
. ~/.bashrc.mine
fi
# bash completion
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi