forked from ndejay/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.bashrc
More file actions
106 lines (81 loc) · 2.17 KB
/
.bashrc
File metadata and controls
106 lines (81 loc) · 2.17 KB
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
#########
# Paths #
#########
if [ -f ~/.bashrc_local ]; then
source ~/.bashrc_local
fi
[ ! -d ~/.vim/swpfiles ] && mkdir -p ~/.vim/swpfiles
###########
# General #
###########
export EDITOR='vim'
export PAGER='less'
###########
# Aliases #
###########
alias R='R --quiet' # R without verbose
alias l='ls --color=auto -rtalh' # faster ls
alias wget='wget --no-check-certificate' # HTTPS error is so annoying
alias nodup="awk '!x[\$0]++'" # removes duplicates
##############
# Protection #
##############
alias rm='rm -i'
alias mv='mv -i'
alias cp='cp -i'
###########
# History #
###########
# export HISTFILE=~/.histfile
export HISTFILESIZE=1000000
export HISTSIZE=1000000
export SAVEHIST=1000000
export HISTCONTROL=ignoreups
export HISTIGNORE='l'
##########
# Colors #
##########
export GREP_OPTIONS='--color=auto' # grep with color output
alias ls='ls --color=auto'
###########
# History #
###########
export HISTFILE=~/.bash_history
#########
# Shell #
#########
shopt -s cmdhist # Combine multiline commands
shopt -s histappend # Merge history sessions
shopt -s extglob # Allows basic regexps
shopt -s checkwinsize # Redraw on window size change
set -o emacs
##########
# Prompt #
##########
# colors: http://seanponeil.com/blog/2012/09/13/sexy-solarized-bash-prompt/
# git: http://www.terminally-incoherent.com/blog/2013/01/14/whats-in-your-bash-prompt/
__prompt_command () {
local reset=$(tput sgr0)
local bold=$(tput bold)
local red=$(tput setaf 1)
local orange=$(tput setaf 3)
local magenta=$(tput setaf 5)
local gray=$(tput setaf 10)
PS1="\[$bold\]\h\[$reset\] \[$gray\]\W\[$reset\]"
local status=$(git status -unormal 2>&1)
if ! [[ "$status" =~ Not\ a\ git\ repo ]] ; then
[[ "$status" =~ nothing\ to\ commit ]] && local on=$orange || local on=$red
if [[ "$status" =~ On\ branch\ ([^[:space:]]+) ]] ; then
local branch=${BASH_REMATCH[1]}
else
local on=$magenta
local branch=$(git describe --all --contains --abbrev=4 HEAD 2>/dev/null || echo HEAD)
fi
[[ -n "$branch" ]] && PS1+=" \[$on\]$branch\[$reset\]"
fi
PS1+=" \$ "
}
export PROMPT_COMMAND=__prompt_command
export PS2='> '
# vim: syntax=sh
eval $(thefuck --alias)