bash/.bashrc (view raw)
1# better history syncing
2shopt -s histappend
3export HISTCONTROL=ignoreboth:erasedups
4HISTSIZE=40000
5HISTFILESIZE=40000
6
7# cool options for cool kids
8shopt -s \
9 autocd \
10 globstar \
11 checkwinsize \
12 cdspell \
13 dirspell \
14 expand_aliases \
15 dotglob \
16 gnu_errfmt \
17 histreedit \
18 nocasematch
19
20bind 'set completion-ignore-case on'
21bind 'set show-all-if-ambiguous on'
22bind 'set colored-stats on'
23bind 'set completion-display-width 1'
24bind 'TAB:menu-complete'
25
26# Ctrl+W kills word
27stty werase undef
28bind '"\C-w": backward-kill-word'
29
30# fzy reverse search
31__fzy_history() {
32 ch="$(fc -l 1 | awk -F'\t' '{print $2}' | sort -u | fzy)"
33 : "${ch#"${ch%%[![:space:]]*}"}"
34 printf "$_"
35}
36
37bind -x '"\C-r": READLINE_LINE=$(__fzy_history); READLINE_POINT="${#READLINE_LINE}"'
38
39complete -cf doas
40
41# z (darwin)
42[[ -f /usr/local/etc/profile.d/z.sh ]] &&
43. /usr/local/etc/profile.d/z.sh
44
45# z (bsd)
46[[ -f ~/bin/z.sh ]] &&
47. ~/bin/z.sh
48
49for i in ~/.bashrc.d/[0-9]*; do
50 . "$i"
51done
52
53export NVM_DIR="$HOME/.nvm"
54[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
55[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
56
57. /usr/local/share/bash-completion/bash_completion