Repository navigation
Expand file tree
/
Copy path.profile
More file actions
209 lines (189 loc) · 6.65 KB
/
Copy path.profile
File metadata and controls
209 lines (189 loc) · 6.65 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
#!/usr/bin/env sh
# ~/.profile
# vim:ft=sh:et:ts=4:sw=4:sts=4:
has() {
command -v "$1" >/dev/null 2>&1
}
# macOS homebrew install paths
export PATH="/opt/homebrew/opt/llvm/bin:/opt/homebrew/bin:/usr/local/bin:$PATH"
if has brew; then
eval "$(brew shellenv)"
fi
# Setup pyenv, see:
# https://github.com/pyenv/pyenv?tab=readme-ov-file#b-set-up-your-shell-environment-for-pyenv
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
# Local executables
export PATH="$HOME/go/bin:$PATH"
export PATH="$HOME/.cargo/bin:$PATH"
export PATH="$HOME/.local/bin:$PATH"
export PATH="$HOME/.bin:$PATH"
# Portable apps
for apps_dir in "$HOME/Apps" "$HOME/.local/apps"; do
if [ ! -d "$apps_dir" ]; then
continue
fi
for dir in "$apps_dir"/*; do
export PATH="$dir:$PATH"
export PATH="$dir/bin:$PATH"
done
done
# Dotfile bare repo path
export DOT_DIR="$HOME/.dot"
if [ -r "$HOME/.envvars" ]; then
. "$HOME/.envvars"
fi
# Setup default editor
for editor in nvim vim vi; do
if has "$editor"; then
export EDITOR="$editor"
[ "$editor" = nvim ] && export MANPAGER='nvim +Man!'
break
fi
done
# Set rg config path
export RIPGREP_CONFIG_PATH="$HOME/.ripgreprc"
export BAT_THEME=ansi
# Fzf configuration
# shellcheck disable=SC2089
# we want to include '' (single quotes) in `--preview` option because opts are
# parsed twice when passing to fzf
#
# Set gutter to space to hide gutter:
# https://github.com/junegunn/fzf/blob/master/CHANGELOG.md#hiding-the-gutter-column
export FZF_DEFAULT_OPTS="--reverse \
--preview='fzf-file-previewer {}' \
--preview-window=right,55%,border-none,nocycle \
--info=inline-right \
--no-separator \
--no-scrollbar \
--border=none \
--margin=1,0,0 \
--height=~75% \
--min-height=16 \
--scroll-off=999 \
--multi \
--ansi \
--color=fg:-1,bg:-1,hl:bold:cyan \
--color=fg+:-1,bg+:-1,hl+:bold:cyan \
--color=border:white,preview-border:white \
--color=marker:bold:cyan,prompt:bold:red,pointer:bold:red \
--color=gutter:grey,info:bold:red,spinner:cyan,header:white \
--bind=ctrl-k:kill-line \
--bind=alt-a:toggle-all \
--bind=alt-up:first,alt-down:last \
--bind=shift-up:preview-up,shift-down:preview-down \
--bind=alt-v:preview-half-page-up,ctrl-v:preview-half-page-down"
fd=$(has fd && echo fd || echo fdfind)
if has "$fd"; then
export FZF_DEFAULT_COMMAND="$fd -p -H -L -td -tf -tl -c=always"
export FZF_ALT_C_COMMAND="$fd -p -H -L -td -c=always"
else
export FZF_DEFAULT_COMMAND="find -L . -mindepth 1 \\( \
-path '*%*' \
-o -path '*.*Cache*/*' \
-o -path '*.*cache*/*' \
-o -path '*.*wine/*' \
-o -path '*.cargo/*' \
-o -path '*.conda/*' \
-o -path '*.dot/*' \
-o -path '*.env/*' \
-o -path '*.fonts/*' \
-o -path '*.git/*' \
-o -path '*.ipython/*' \
-o -path '*.java/*' \
-o -path '*.jupyter/*' \
-o -path '*.luarocks/*' \
-o -path '*.mozilla/*' \
-o -path '*.npm/*' \
-o -path '*.nvm/*' \
-o -path '*.steam*/*' \
-o -path '*.thunderbird/*' \
-o -path '*.tmp/*' \
-o -path '*.venv/*' \
-o -path '*Cache*/*' \
-o -path '*\\\$*' \
-o -path '*\\~' \
-o -path '*__pycache__/*' \
-o -path '*cache*/*' \
-o -path '*dosdevices/*' \
-o -path '*env/*' \
-o -path '*node_modules/*' \
-o -path '*vendor/*' \
-o -path '*venv/*' \
-o -fstype 'sysfs' \
-o -fstype 'devfs' \
-o -fstype 'devtmpfs' \
-o -fstype 'proc' \\) -prune \
-o -type f -print \
-o -type d -print \
-o -type l -print 2> /dev/null | cut -b3-"
export FZF_ALT_C_COMMAND="find -L . -mindepth 1 \\( \
-path '*%*' \
-o -path '*.*Cache*/*' \
-o -path '*.*cache*/*' \
-o -path '*.*wine/*' \
-o -path '*.cargo/*' \
-o -path '*.conda/*' \
-o -path '*.dot/*' \
-o -path '*.fonts/*' \
-o -path '*.git/*' \
-o -path '*.ipython/*' \
-o -path '*.java/*' \
-o -path '*.jupyter/*' \
-o -path '*.luarocks/*' \
-o -path '*.mozilla/*' \
-o -path '*.npm/*' \
-o -path '*.nvm/*' \
-o -path '*.env/*' \
-o -path '*.steam*/*' \
-o -path '*.thunderbird/*' \
-o -path '*.tmp/*' \
-o -path '*.venv/*' \
-o -path '*Cache*/*' \
-o -path '*\\\$*' \
-o -path '*\\~' \
-o -path '*__pycache__/*' \
-o -path '*cache*/*' \
-o -path '*dosdevices/*' \
-o -path '*env/*' \
-o -path '*node_modules/*' \
-o -path '*vendor/*' \
-o -path '*venv/*' \
-o -fstype 'sysfs' \
-o -fstype 'devfs' \
-o -fstype 'devtmpfs' \
-o -fstype 'proc' \\) -prune \
-o -type d -print 2> /dev/null | cut -b3-"
fi
export FZF_CTRL_R_OPTS=--no-preview
export FZF_PREVIEW_DISABLE_UB=true # Disable ueberzug preview
# Ensure color theme files are correctly linked
has setbg && ( setbg & ) 2>/dev/null
has setcolors && ( setcolors & ) 2>/dev/null
# Automatically login to proot distro on termux
if has proot-distro &&
[ -n "$PROOT_DISTRO" ] &&
[ -n "$PROOT_USER" ] &&
[ -n "$TERMUX_VERSION" ]; then
exec proot-distro login "$PROOT_DISTRO" --user "$PROOT_USER" --termux-home
fi
# Greeting message
if [ ! -e "${XDG_RUNTIME_DIR:-${TMPDIR:-/tmp}}/greeted" ]; then
touch "${XDG_RUNTIME_DIR:-${TMPDIR:-/tmp}}/greeted"
if has fastfetch; then
fetch=fastfetch
elif has neofetch; then
fetch=neofetch
fi
if [ -n "$fetch" ]; then
# Run in pseudo-terminal to prevent terminal state issues
# (tmux error: 'not a terminal', etc)
# macOS `script` does not accept `-c` flag
if script -q /dev/null -c exit >/dev/null 2>&1; then
script -q /dev/null -c "$fetch"
else
script -q /dev/null "$fetch"
fi
fi
fi