-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.commonrc
58 lines (47 loc) · 1.17 KB
/
.commonrc
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
#!/usr/bin/env sh
function prepend_path() {
if [ -d "$1" ]; then
export PATH="$1:$PATH"
fi
}
function append_path() {
if [ -d "$1" ]; then
export PATH="$PATH:$1"
fi
}
function command_exists() {
command -v "$1" 2>&1 > /dev/null
}
function checked_alias() {
if command_exists "$2"; then
alias "$1"="$2"
else
echo "Command '$2' not found."
fi
}
# Configure the editor to be, in order:
# nvim -> vim -> vi
if command_exists nvim; then
export EDITOR=nvim
export MANPAGER='nvim +Man!' # viewing man pages in nvim is pretty dope
elif command_exists vim; then
export EDITOR=vim
elif command_exists vi; then
export EDITOR=vi
fi
# Prompt strings.
PS1='[\u@\h \W]\$ ' # bash
PROMPT='%n %d %# ' # zsh
# Rust setup.
if [ -f "$HOME/.cargo/env" ]; then
. "$HOME/.cargo/env"
fi
append_path ~/.bin
append_path /usr/local/go/bin
append_path ~/go/bin
append_path /usr/local/vscode
append_path ~/.local/share/nvim/mason/bin
prepend_path ~/.pyenv/shims
checked_alias vim nvim
# Dotfiles. Uses the "cnf" script under ~/.bin/
cnf config --local status.showUntrackedFiles no # Hide files we are not explicitly tracking yet