-
Notifications
You must be signed in to change notification settings - Fork 0
/
bashrc
91 lines (61 loc) · 1.74 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
########################################
# ~/.bashrc
# Bash settings
#
# Sections:
# -> Start-up
# -> General
# -> Prompt
########################################
########################################
# => Start-up
########################################
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# Source global definitions
if [[ -f /etc/bashrc ]]; then
. /etc/bashrc
fi
# Completions
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
# Find any local definitions
if [[ -f ~/.dotfiles/local/bashrc ]]; then
. ~/.dotfiles/local/bashrc
fi
# Get aliases, variables from files
source ~/.dotfiles/variables
source ~/.dotfiles/aliases
########################################
# => General
########################################
#Don't save duplicate lines
export HISTCONTROL=erasedups
shopt -s autocd
# Context search through history (like zsj)
bind '"\e[A": history-search-backward'
bind '"\e[B": history-search-forward'
bind 'set completion-ignore-case on'
# Append to history on every command
export PROMPT_COMMAND='history -a'
########################################
# => Prompt
########################################
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \[\1\]/'
}
function proml {
local BLUE="\[\033[0;34m\]"
# OPTIONAL - if you want to use any of these other colors:
local RED="\[\033[0;31m\]"
local LIGHT_RED="\[\033[1;31m\]"
local GREEN="\[\033[0;32m\]"
local LIGHT_GREEN="\[\033[1;32m\]"
local WHITE="\[\033[1;37m\]"
local LIGHT_GRAY="\[\033[0;37m\]"
# END OPTIONAL
local DEFAULT="\[\033[0m\]"
PS1="\u@\h (\W)$BLUE\$(parse_git_branch) $DEFAULT\$ "
}
proml