-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
dot_bashrc
124 lines (103 loc) · 3.57 KB
/
dot_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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#!/usr/bin/env bash
# return if not interactive shell
if [[ $- != *i* ]]; then
return
fi
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
if [ -x /usr/bin/lesspipe ]; then
eval "$(SHELL=/bin/sh lesspipe)"
fi
# {{{ env
export XDG_CACHE_HOME="${HOME}/.cache"
export XDG_CONFIG_HOME="${HOME}/.config"
export XDG_DATA_HOME="${HOME}/.local/share"
export XDG_STATE_HOME="${HOME}/.local/state"
export EDITOR="vim"
export VISUAL="nvim"
export PAGER="less"
export MANPAGER="less -R"
# env }}}
export DOTFILES="${HOME}/.local/share/chezmoi"
export DOTFILES_MODULES="${DOTFILES}/.modules"
export PATH="${HOME}/.local/bin:${DOTFILES}/.scripts.sh:${PATH}"
# {{{ tools
export CARGO_HOME="${XDG_DATA_HOME}/cargo"
export RUSTUP_HOME="${XDG_DATA_HOME}/rustup"
export FNM_DIR="${XDG_DATA_HOME}/fnm"
export GOLANG_DIR="${XDG_DATA_HOME}/golang"
export LUVER_DIR="${XDG_DATA_HOME}/luver"
export PYENV_ROOT="${HOME}/.pyenv"
export RBENV_ROOT="${HOME}/.rbenv"
# tools }}}
# {{{ completion
if [ -f /etc/bash_completion ]; then
source /etc/bash_completion
elif [ -r /usr/local/etc/profile.d/bash_completion.sh ]; then
source /usr/local/etc/profile.d/bash_completion.sh
fi
# completion }}}
# sensible defaults
if [ -f "${DOTFILES_MODULES}/.bash-sensible/sensible.bash" ]; then
source "${DOTFILES_MODULES}/.bash-sensible/sensible.bash"
fi
source "${DOTFILES_MODULES}/helpers.sh"
source "${DOTFILES_MODULES}/aliases.sh"
source "${DOTFILES_MODULES}/fzf.plugin.sh"
source "${DOTFILES_MODULES}/go.plugin.sh"
source "${DOTFILES_MODULES}/gpg.plugin.sh"
source "${DOTFILES_MODULES}/lf.plugin.sh"
source "${DOTFILES_MODULES}/bash/plugins/luver.plugin.bash"
source "${DOTFILES_MODULES}/node.plugin.sh"
source "${DOTFILES_MODULES}/python.plugin.sh"
source "${DOTFILES_MODULES}/ruby.plugin.sh"
source "${DOTFILES_MODULES}/rust.plugin.sh"
source "${DOTFILES_MODULES}/machine.local.plugin.sh"
# {{{ appearance
if [ -x /usr/bin/dircolors ]; then
_dircolors_file="${DOTFILES_MODULES}/.dircolors-solarized/dircolors.256dark"
test -r "${_dircolors_file}" && eval "$(dircolors -b "${_dircolors_file}")" || eval "$(dircolors -b)"
fi
alias dir='dir --color=auto'
alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
export GREP_COLOR='1;33'
# colored GCC warnings and errors
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
# appearance }}}
# {{{ ls
if command_exists eza; then
declare -g eza_params=("--git" "--icons" "--classify" "--group-directories-first" "--time-style=long-iso" "--group" "--color-scale")
ls() { eza "${eza_params[@]}" $@; }
l() { eza --git-ignore "${eza_params[@]}" $@; }
la() { eza -a "${eza_params[@]}" $@; }
ll() { eza --header --long "${eza_params[@]}" $@; }
else
declare -g ls_params=("-hF" "--group-directories-first" "--time-style=+%Y-%m-%d %H:%M" "--quoting-style=literal" "--color=auto")
ls() { command ls "${ls_params[@]}" -C $@; }
l() { command ls "${ls_params[@]}" -C $@; }
la() { command ls "${ls_params[@]}" -C -A $@; }
ll() { command ls "${ls_params[@]}" -l $@; }
fi
# ls }}}
# {{{ zoxide
if command_exists zoxide; then
eval "$(zoxide init bash --no-cmd)"
z() { __zoxide_z $@; }
fi
# zoxide }}}
# {{{ utilities
reload_shell() {
exec ${current_shell:-"bash"}
}
# utilities }}}
# {{{ starship
export STARSHIP_CONFIG=~/.config/starship/config.toml
eval "$(starship init bash)"
export PROMPT_COMMAND="starship_precmd;${PROMPT_COMMAND/starship_precmd;/}"
# starship }}}
# vim: set foldmethod=marker :