-
Notifications
You must be signed in to change notification settings - Fork 1
/
bashrc.symlink
114 lines (95 loc) · 3.96 KB
/
bashrc.symlink
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
108
109
110
111
112
113
114
#==============================================================================
# Configuration for non-login shells ...
#==============================================================================
#------------------------------------------------------------------------------
# General
#------------------------------------------------------------------------------
set -o ignoreeof
#------------------------------------------------------------------------------
# asdf
#------------------------------------------------------------------------------
if [ -d "$HOME/.asdf" ]; then
source "$HOME/.asdf/asdf.sh"
source "$HOME/.asdf/completions/asdf.bash"
fi
#------------------------------------------------------------------------------
# Alias & Completions
#------------------------------------------------------------------------------
alias ls="ls --no-group --color --human-readable"
alias ll="ls --no-group --color --human-readable -l"
alias la="ls --no-group --color --human-readable -l --all"
alias vi="$EDITOR" vim="$EDITOR" nvim="$EDITOR"
if command -v bundle > /dev/null; then
alias bx="bundle exec"
fi
if command -v git > /dev/null; then
alias g="git"
if [ -f /usr/share/bash-completion/completions/git ]; then
source /usr/share/bash-completion/completions/git
__git_complete g git # enable completions for the alias
fi
fi
if command -v moment > /dev/null; then
alias m="moment"
fi
if command -v pass > /dev/null; then
alias p="pass"
if [ -f /usr/share/bash-completion/completions/pass ]; then
source /usr/share/bash-completion/completions/pass
complete -o filenames -F _pass p # enable completions for the alias
fi
fi
if command -v docker > /dev/null; then
alias d="docker"
fi
if command -v task > /dev/null; then
alias t="task"
fi
#------------------------------------------------------------------------------
# FZF
#------------------------------------------------------------------------------
if command -v fzf > /dev/null; then
export FZF_CTRL_T_COMMAND="fd --type f --hidden"
export FZF_DEFAULT_OPTS="--bind 'ctrl-a:select-all,ctrl-d:deselect-all'"
[ -f /usr/share/fzf/key-bindings.bash ] && source /usr/share/fzf/key-bindings.bash
fi
#------------------------------------------------------------------------------
# Prompt and Window Title (with Git Support if available)
#------------------------------------------------------------------------------
function __prompt_and_window_title {
local exit_code="$?"
local color_reset="\[\e[0m\]"
local color_bold="\[\e[1m\]"
local color_yellow="\[\e[33m\]"
local color_blue="\[\e[34m\]"
local color_red="\[\e[31m\]"
local color_light_red="\[\e[91m\]"
if [ -f /usr/share/git/completion/git-prompt.sh ]; then
source /usr/share/git/completion/git-prompt.sh
GIT_PS1_SHOWDIRTYSTATE=true
GIT_PS1_SHOWUNTRACKEDFILES=true
GIT_PS1_SHOWUPSTREAM=auto
local git_status='`__git_ps1`'
fi
if [ ! -z ${VIRTUAL_ENV_PROMPT+x} ]; then
local python_venv=" ${color_yellow}$(echo $VIRTUAL_ENV_PROMPT | xargs)${color_reset}"
fi
local window_title="\[\e]2;\w\a\]"
local prompt="\w$python_venv$color_bold$git_status$color_reset "
if [ $exit_code != 0 ]; then
prompt+="$color_light_red[$exit_code]$color_reset $color_red$color_reset "
else
prompt+="$color_blue$color_reset "
fi
PS1="$prompt$window_title"
}
PROMPT_COMMAND=__prompt_and_window_title
#------------------------------------------------------------------------------
# History
#------------------------------------------------------------------------------
export HISTFILE="$HOME/.histories/bash" # set custom file location
export HISTCONTROL="ignoreboth:erasedups" # ignore entries starting with space + duplicates
export HISTSIZE="infinity" # infinite number of commands
export HISTFILESIZE="infinity" # infinite number of lines
export HISTIGNORE="clear:exit" # ignore boring commands
shopt -s histappend # on exit, append to the history file