-
Notifications
You must be signed in to change notification settings - Fork 0
/
.shrc
82 lines (70 loc) · 2.1 KB
/
.shrc
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
#!/bin/sh
# shellcheck disable=SC3003,SC3028,SC2154
# add shell functions
if [ -r "${HOME}/.functions" ]; then
# shellcheck source=.functions
. "${HOME}/.functions"
fi
# ensure .shrc is only loaded once
if [ "${DOT_SHRC}" = "true" ]; then
debuglog "already loaded .shrc"
return
else
debuglog "begin loading .shrc"
fi
# load aliases
if [ -r "${HOME}/.aliases" ]; then
# shellcheck source=.aliases
. "${HOME}/.aliases"
fi
# install global brewfile
HOMEBREW_BUNDLE_GLOBAL_FILE="${HOME}/.Brewfile"
if validate_command brew \
&& [ -f "${HOMEBREW_BUNDLE_GLOBAL_FILE}" ] \
&& [ ! -f "${HOMEBREW_BUNDLE_GLOBAL_FILE}.lock.json" ] \
&& [ "${SKIP_BREW_BUNDLE:-false}" != "false" ] \
&& [ "${MACOS}" = 1 ]; then
brew bundle install --file "${HOMEBREW_BUNDLE_GLOBAL_FILE}"
else
unset HOME_BREW_BUNDLE_GLOBAL_FILE
fi
# Colourful manpages
export LESS_TERMCAP_mb=$'\E[01;31m'
export LESS_TERMCAP_md=$'\E[01;31m'
export LESS_TERMCAP_me=$'\E[0m'
export LESS_TERMCAP_se=$'\E[0m'
export LESS_TERMCAP_so=$'\E[01;44;33m'
export LESS_TERMCAP_ue=$'\E[0m'
export LESS_TERMCAP_us=$'\E[01;32m'
# Set to avoid `env` output from changing console colour
export LESS_TERMEND=$'\E[0m'
export LESS="--RAW-CONTROL-CHARS"
# enable cli color
export CLICOLOR="true"
# Preferred editor for local and remote sessions
if [ -n "${SSH_CONNECTION}" ]; then
if validate_command nvim; then
export EDITOR="nvim"
elif validate_command nano; then
export EDITOR="nano"
fi
else
if validate_command code; then
export EDITOR="code --wait"
elif validate_command nvim; then
export EDITOR="nvim"
elif validate_command nano; then
export EDITOR="nano"
fi
fi
# set gem path
if validate_command gem && [ -d "$(ruby -r rubygems -e 'puts Gem.user_dir')" ]; then
GEM_HOME="$(ruby -r rubygems -e 'puts Gem.user_dir')"
export GEM_HOME
fi
# export GEM_PATH="${HOME}/.gem/ruby/2.6.0:/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0"
# fi
# set word splitting
# export WORDCHARS='~!#$%^&*(){}[]<>?.+;-'
DOT_SHRC="true"
debuglog "done loading .shrc"