-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathprofile
More file actions
142 lines (118 loc) · 3.81 KB
/
profile
File metadata and controls
142 lines (118 loc) · 3.81 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
#stop hiding Library folder, Apple
chflags nohidden ~/Library
# case insensitive bash filename completion
# shopt -s nocaseglob
# Bypass use of .inputrc with 'bind' syntax
# bind "set completion-ignore-case on"
# bind "set show-all-if-ambiguous on"
# bind "set show-all-if-unmodified on"
# bind "set visible-stats on"
# let's use hub for all my git needs
eval "$(hub alias -s)"
# more colorful subshells
export CLIE_COLOR=1
export GREP_OPTIONS='--color=auto'
export LESS='-iMRXFfx4'
export EDITOR='vim'
# make man colorful
export LESS_TERMCAP_mb=$'\E[01;31m' # begin blinking
export LESS_TERMCAP_md=$'\E[01;38;5;74m' # begin bold
export LESS_TERMCAP_me=$'\E[0m' # end mode
export LESS_TERMCAP_se=$'\E[0m' # end standout-mode
export LESS_TERMCAP_so=$'\E[1;31m' # begin standout-mode - info box
export LESS_TERMCAP_ue=$'\E[0m' # end underline
export LESS_TERMCAP_us=$'\E[04;33;5;146m' # begin underline
# ensure utf8 is enabled
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
# no spying homebrew
export HOMEBREW_NO_ANALYTICS=1
# History: don't store duplicates
export HISTCONTROL=erasedups
# History: 10,000 entries
export HISTSIZE=100000
# e: exit without q at end, r: color codes, X: leave results in buffer
export LESS="-erX"
# export FZF_DEFAULT_COMMAND='ag --hidden -g ""'
export FZF_DEFAULT_COMMAND='rg --files'
# NOTE MacOS needs you to 'touch ~/.iex_history' before it works
export ERL_AFLAGS="-kernel shell_history enabled"
# asdf will build erlang docs available in iex (Elixir 1.11+ and OTP 23+)
export KERL_BUILD_DOCS="yes"
# avoid JInterface stuff in erlang
export KERL_CONFIGURE_OPTIONS="--without-javac"
export MIX_OS_DEPS_COMPILE_PARTITION_COUNT=6
export PATH=/bin:~/bin:$PATH
# rg has no default path; must be specified
export RIPGREP_CONFIG_PATH=~/.config/ripgrep
alias vim=nvim
alias ls='ls -aFGh'
alias ll='ls -lah'
alias myip='curl ifconfig.co'
alias :q=exit
alias iep='iex -S mix phx.server'
alias iem='iex -S mix'
function gmux {
# This is Greg's tmux/wemux so I can stop looking up precise syntax
# This is a find or create function for how I use tmux
name=${1:-work} #use 1st arg or "work" as default
wemux new -s $name || wemux attach-session -t $name
}
# zsh prezto "helpfully" creates this alias
# unalias g
function g {
if [[ $# > 0 ]]; then
git "$@"
else
git status --short --branch
fi
}
# get tab completion with my function
# this for bash
# __git_complete g _git
# this for zsh
compdef _git g=git
# light: source highlight code in clipboard or file to clipboard for pasting
# note: requires `brew install highlight`
# call as either `light <filetype || elixir>` or `light <filetype> <filename>`
# available themes/langs: highlight --list-scripts=themes
function light() {
if [ -z "$2" ]
then src="pbpaste"
else
src="cat $2"
fi
$src | \
highlight \
--out-format rtf \
--syntax ${1:-elixir} \
--font "Fira Code Retina" \
--font-size 24 \
--style github | \
pbcopy
}
function guitar_tuner {
#note: requires 'brew install sox'
n=('' E4 B3 G3 D3 A2 E2);while read -n1 -p 'string? ' i;do case $i in [1-6]) play -n synth pl ${n[i]} fade 0 1 ;; *) echo;break;;esac;done
}
function explain () {
if [ "$#" -eq 0 ]; then
while read -p "Command: " cmd; do
curl -Gs "https://www.mankier.com/api/explain/?cols="$(tput cols) --data-urlencode "q=$cmd"
done
echo "Bye!"
elif [ "$#" -eq 1 ]; then
curl -Gs "https://www.mankier.com/api/explain/?cols="$(tput cols) --data-urlencode "q=$1"
else
echo "Usage"
echo "explain interactive mode."
echo "explain 'cmd -o | ...' one quoted command to explain it."
fi
}
# Setup fzf
# ---------
if [[ ! "$PATH" == */usr/local/opt/fzf/bin* ]]; then
export PATH="$PATH:/usr/local/opt/fzf/bin"
fi
export FZF_TMUX_HEIGHT='20%'
# TODO there's more fzf setup for zsh