-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.bashrc
107 lines (72 loc) · 2.95 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
################################################################################
### Do nothing when Bash runs non-interactively
################################################################################
[ -z "$PS1" ] && return
################################################################################
### Options
################################################################################
## Emacs style key bindings
set -o emacs
## Don't exit on Ctrl-D
set -o ignoreeof
## Activate i-search by pressing C-s
stty -ixon
################################################################################
### Environment
################################################################################
export SHELL=/bin/bash
export EDITOR=emacs
export PAGER=less
## Set up locales
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
################################################################################
### Github directory
################################################################################
export GITHUB=$HOME/github
################################################################################
### Path
################################################################################
## Add my Emacs binaries to $PATH
PATH="$GITHUB/emacs/bin:$PATH"
## Export updated $PATH
export PATH
################################################################################
### Aliases
################################################################################
# alias ag="ag --path-to-ignore=$GITHUB/dotfiles/.ignore_global"
################################################################################
### Keys
################################################################################
## Hint: `bind -P` will show all key bindings
## Search history a la tcsh
bind '"\e[A": history-search-backward'
bind '"\e[B": history-search-forward'
bind '"\C-p": history-search-backward'
bind '"\C-n": history-search-forward'
################################################################################
### Prompt
################################################################################
add_git_branch_to_prompt() {
branch=$(git branch 2>/dev/null | sed -n '/\* /s///p')
if [ -n "$branch" ]; then
# Paint it Magenta
echo "("$'\033[35m'"$branch"$'\033[00m'") "
fi
}
export PS1="\w \$(add_git_branch_to_prompt)\$ "
################################################################################
### History
################################################################################
## Append to the history file, don't overwrite it
shopt -s histappend
## Save multi-line commands to the history as one command
shopt -s cmdhist
## Save and reload history after each command finishes
export PROMPT_COMMAND="history -a; history -c; history -r;"
## Huge history
export HISTSIZE=500000
export HISTFILESIZE=100000
## No duplicates, please
export HISTCONTROL="erasedups:ignoreboth"