-
Notifications
You must be signed in to change notification settings - Fork 20
/
.commonenv
145 lines (122 loc) · 3.37 KB
/
.commonenv
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
# shellcheck shell=bash
source ~/.commonfuncs
# let's set a proper PATH
#########################
# This is an attempt to use a fancy path generator
# like the one in .zshenv
new_path=""
expected_path=(
"$HOME/.dotfiles"
./bin
"$HOME/bin"
"$HOME/bin/git_achievements"
./node_modules/.bin
"$HOME/.asdf/shims"
"$HOME/.rbenv/bin"
"$HOME/.rbenv/shims"
"$HOME/.rvm/bin"
"$HOME/.cargo/bin"
"$HOME/.luarocks/bin"
"$HOME/Library/Android/sdk/platform-tools"
/opt/homebrew/bin
/opt/python/bin
/opt/local/bin
/opt/local/sbin
/sw/bin
/sw/sbin
/usr/local/bin
/usr/local/sbin
/sbin
/bin
/usr/bin
/usr/sbin
/usr/ucb
/usr/bsd
/usr/libexec
/usr/X11R6/bin
/usr/X11/bin
/usr/bin/X11
/usr/local/X11/bin
/usr/local/games
/usr/games
"$HOME/.virtualenvs/tools/bin"
)
for element in "${expected_path[@]}"
do
if [ -d "$element" ]; then
if [ -z $new_path ]; then
new_path=$element
else
new_path=$new_path:$element
fi
fi
done
PATH=$new_path
export PATH
# Enable a few things for less (This will also apply to man)
# * turn off case sensitive search (-I)
# * display a long prompt with more info (-M)
# * show colors instead of escape characters (-R)
# * don't clear the screen on exit (-X)
export LESS="-IMRX"
# Make bat and delta act like less as setup above
export BAT_PAGER="less $LESS"
# Force C style sorting (e.g. dotfiles, then Uppercase then lowercase)
export LC_COLLATE=C
# use a fancy terminal if we aren't using tmux
[ -z "$TMUX" ] && export TERM=xterm-256color
# conditionally set the editor variable
# TODO: get mvim -f to work with crontab some day :)
if checkPath nvim; then
PREFERRED_EDITOR=nvim
elif checkPath vim; then
PREFERRED_EDITOR=vim
elif checkPath mate_wait; then
# to set this up you need to symlink the mate command
# $ cd ~/bin
# $ ln -s /path/to/mate mate_wait
PREFERRED_EDITOR=mate_wait
else
# there should be at least vi on the machine!
PREFERRED_EDITOR=vi
fi
export EDITOR=$PREFERRED_EDITOR
# get crazy with python, and the cheese whiz
export PYTHONSTARTUP=$HOME/.pystartup
# Set diff tool for rails / thor
if checkPath nvim; then
MERGETOOL="nvim -d"
elif checkPath vim; then
MERGETOOL="vimdiff"
fi
export THOR_MERGE=$MERGETOOL
# Make sure ruby-build gets access to readline
# To check if it worked, do the following:
# $ ruby -rreadline -e 'puts Readline::VERSION'
# 6.3
# You should see a version number and NOT 'editline'
[ -d "/opt/local" ] && export RUBY_CONFIGURE_OPTS="--with-readline-dir=/opt/local"
# colors!!!
###########
# for FreeBSD
# Pretty LSCOLORS explanation:
# http://www.mjxg.com/index.py/geek/lscolors_and_ls_colors
export LSCOLORS="exFxbxbhcxfxgxdxdhebeb"
# set the ACK match color scheme
export ACK_COLOR_MATCH="red"
# Bat
export BAT_THEME="OneHalfLight"
# Fancy git output
if checkPath delta; then
# NOTE: delta style and config is in ~/.gitconfig for any delta invocation
export GIT_PAGER=delta
fi
# Ripgrep config
export RIPGREP_CONFIG_PATH=$HOME/.ripgreprc
export GREP_COLORS="ms=01;31:mc=01;31:sl=:cx=:fn=32:ln=36:bn=32:se=39"
# FZF
export FZF_DEFAULT_COMMAND='find -L . -type f -o -type d -o -type l | sed 1d | cut -b3- | grep -v -e .git/ -e .svn/ -e .hg/'
export FZF_CTRL_T_COMMAND=$FZF_DEFAULT_COMMAND
export FZF_DEFAULT_OPTS='--extended --multi --inline-info --prompt="fzf> "'
# Disable spring in rails
export DISABLE_SPRING=true