-
Notifications
You must be signed in to change notification settings - Fork 0
/
.bashrc
74 lines (61 loc) · 2.5 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
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
# Include shell functions
source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/functions.sh"
# Report the current working directory to the terminal when the directory is changed
export PROMPT_COMMAND="${PROMPT_COMMAND:-}${PROMPT_COMMAND:+";"}update_terminal_cwd"
# Data dir
mkdir -p "${XDG_STATE_HOME:-$HOME/.local/state}/bash"
# History size and location
HISTSIZE=10000
HISTFILESIZE=10000
HISTFILE=${XDG_STATE_HOME:-$HOME/.local/state}/bash/bash_history
# 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
# Check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# Set up the prompt
if [[ $(tty) =~ tty[0-9]$ ]]; then
export PROMPT_SEPARATOR=''
export PROMPT_BRANCH=''
export PROMPT_CONTEXT_BG=255
fi
source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/theme.bash"
# Enable bash completion, if it's not already enabled in /etc/bash.bashrc
if ! shopt -oq posix && [ -z "${BASH_COMPLETION_VERSINFO:-}" ]; 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
# Aliases, dirhistory and zoxide
source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliases.sh"
source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/dirhistory.bash"
command -v zoxide &> /dev/null && eval "$(zoxide init bash)"
# Set up lf key binding
command -v lf &> /dev/null && bind '"\C-o":"\C-u\C-klf\C-m"'
# Set up fzf key bindings and fuzzy completion
if command -v fzf &> /dev/null; then
eval "$(fzf --bash)"
__fzf_cd__() {
local dir
dir=$(
FZF_DEFAULT_COMMAND=${FZF_ALT_C_COMMAND:-} \
FZF_DEFAULT_OPTS=$(__fzf_defaults "--reverse --walker=dir,follow,hidden --scheme=path" "${FZF_ALT_C_OPTS-} +m") \
FZF_DEFAULT_OPTS_FILE='' $(__fzfcmd)
) && printf 'cd -- %q' "$(builtin unset CDPATH && builtin cd -- "$dir" && builtin pwd)"
}
_fzf_setup_completion path lvim v
_fzf_setup_completion dir tree
command -v fzf-alt-c &> /dev/null && export FZF_ALT_C_COMMAND="fzf-alt-c"
command -v fzf-ctrl-t &> /dev/null && export FZF_CTRL_T_COMMAND="fzf-ctrl-t"
fi
# Colored GCC warnings and errors
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'