-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdot_bashrc.tmpl
More file actions
111 lines (94 loc) · 2.9 KB
/
dot_bashrc.tmpl
File metadata and controls
111 lines (94 loc) · 2.9 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
107
108
109
110
111
{{ if eq .chezmoi.os "linux" -}}
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
# Window size check after each command
shopt -s checkwinsize
# lesspipe for non-text files
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# Bash completion
if ! shopt -oq posix; 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
# Linuxbrew environment
if [[ -x /home/linuxbrew/.linuxbrew/bin/brew ]]; then
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
elif [[ -x "$HOME/.linuxbrew/bin/brew" ]]; then
eval "$("$HOME/.linuxbrew/bin/brew" shellenv)"
fi
export HOMEBREW_NO_ENV_HINTS=1
# PATH
export PATH="$HOME/.local/bin:$PATH"
# Editor
export EDITOR="code"
# Headless Linux: prefer nano when no display server present
if [[ -z "${DISPLAY:-}" && -z "${WAYLAND_DISPLAY:-}" ]]; then
export EDITOR="nano"
fi
# History
HISTSIZE=5000
HISTFILE=~/.bash_history
HISTCONTROL=ignoredups:erasedups
shopt -s histappend
# Homebrew
HOMEBREW_NO_ENV_HINTS=1
# Aliases
if command -v eza >/dev/null 2>&1; then
alias ls='eza --icons=always --hyperlink'
fi
alias c='clear'
# Integrations
if [[ "$TERM_PROGRAM" == "vscode" ]] && command -v code >/dev/null 2>&1; then
. "$(code --locate-shell-integration-path bash)"
fi
if command -v thefuck >/dev/null 2>&1; then
eval "$(thefuck --alias)"
fi
if command -v uv >/dev/null 2>&1; then
eval "$(uv generate-shell-completion bash)"
eval "$(uvx --generate-shell-completion bash)"
fi
if command -v chezmoi >/dev/null 2>&1; then
eval "$(chezmoi completion bash)"
fi
# ble.sh — syntax highlighting and autosuggestions (must be sourced first)
if [[ -f ~/.local/share/blesh/ble.sh ]]; then
source ~/.local/share/blesh/ble.sh --noattach
# fzf integration via ble.sh (replaces plain fzf --bash)
if command -v fzf >/dev/null 2>&1; then
_ble_fzf_path="$(command -v fzf)"
_ble_contrib_fzf_base="${_ble_fzf_path%/*/*}"
ble-import -d contrib/integration/fzf-completion
ble-import -d contrib/integration/fzf-key-bindings
fi
else
# Fallback if ble.sh not yet installed
if command -v fzf >/dev/null 2>&1; then
eval "$(fzf --bash)"
fi
fi
# completions for rbw (Bitwarden CLI alternative)
if command -v rbw >/dev/null 2>&1; then
eval "$(rbw gen-completions bash)"
fi
# Oh My Posh
if command -v oh-my-posh >/dev/null 2>&1; then
eval "$(oh-my-posh init bash --config "$HOME/.config/oh-my-posh/zen.toml")"
fi
if command -v tailscale >/dev/null 2>&1; then
source <(tailscale completion bash)
fi
# Attach ble.sh after prompt is set up
[[ ${BLE_VERSION-} ]] && ble-attach
{{ end -}}
export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/rbw/ssh-agent-socket"
# zoxide recommends initialization at the end of shell config
if [[ $- == *i* ]] && command -v zoxide >/dev/null 2>&1; then
eval "$(zoxide init --cmd cd bash)"
fi