-
Notifications
You must be signed in to change notification settings - Fork 0
/
.zshrc.veezus
125 lines (101 loc) · 3.62 KB
/
.zshrc.veezus
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
alias be="bundle exec"
alias changed='git diff --name-only --diff-filter=ACMRTUXB main'
alias coauth='printf "Co-authored-by: %s" "$(git log --pretty=format:"%an <%ae>" -1000 | sort | uniq | fzf)" | pbcopy'
alias dose="docker-compose"
alias g="git"
alias jtags="ctags -R app config lib && sed -i '' -E '/^(if|switch|function|module\.exports|it|describe).+language:js$/d' tags"
alias heroku="time heroku"
alias k="kubectl"
alias kamal="docker run -it --rm -v '${PWD}:/workdir' -v '/run/host-services/ssh-auth.sock:/run/host-services/ssh-auth.sock' -e SSH_AUTH_SOCK='/run/host-services/ssh-auth.sock' -v /var/run/docker.sock:/var/run/docker.sock ghcr.io/basecamp/kamal:latest"
alias ll="ls -lahF"
alias make="time make"
alias rails="time bundle exec rails"
alias rake="time bundle exec rake"
alias rspec="time bundle exec rspec"
alias rubochanged='changed "./***.rb" | xargs rubocop -A'
alias specchanged='changed "./***_spec.rb" | xargs rspec'
alias vi="vim"
alias whosbeeneatingmycookies="git whosbeeneatingmycookies | column -ts$'\t'"
export EDITOR=vim
export LANG=en_US.utf-8
export RUBYOPT="-rdebug"
# https://stackoverflow.com/questions/75247041/ruby-3-0-4-with-postgres-14-throws-segmentation-fault
export PGGSSENCMODE="disable"
# Prompt
autoload -Uz vcs_info
precmd() { vcs_info }
zstyle ':vcs_info:git:*' formats '(%b) '
setopt PROMPT_SUBST
PROMPT='%B%n@%m%b %F{243}%*%f %F{039}%~%f %F{171}${vcs_info_msg_0_}%f$ '
# equivalents: AUTO_CD autocd
setopt COMBINING_CHARS
# Good night, Case Insensitivity. Good work. Sleep well. I'll most likely delete you in the morning
setopt NO_CASE_GLOB
# History configuration
HISTFILE=${ZDOTDIR:-$HOME}/.zsh_history
HISTORY_IGNORE='(fg)'
HISTSIZE=10000
SAVEHIST=5000
setopt APPEND_HISTORY
setopt INC_APPEND_HISTORY
setopt EXTENDED_HISTORY
setopt SHARE_HISTORY
setopt HIST_EXPIRE_DUPS_FIRST
setopt HIST_FIND_NO_DUPS
setopt HIST_IGNORE_SPACE
setopt HIST_REDUCE_BLANKS
zshaddhistory() {
emulate -L zsh
## uncomment if HISTORY_IGNORE
## should use EXTENDED_GLOB syntax
# setopt extendedglob
[[ $1 != ${~HISTORY_IGNORE} ]]
}
# Correct misspellings. Ugh, actually, it autocorrects incessantly and incorrectly.
# setopt CORRECT
# setopt CORRECT_ALL
# `gems` performs a rubygems single-gem search
gems() {
gem search -ra $1|grep "^$1 "
}
# `tags` generates tags using both ctags and ripper-tags (for ruby)
tags() {
ctags -R . --exclude="*.rb"
ripper-tags -Ra
}
# `code` creates or attaches to an existing tmux session for repositories in
# the code directory
[ -e "$CODE_DIR" ] || CODE_DIR="$HOME/code"
export CODE_DIR
code() {
cd "$CODE_DIR/$1"
tmux attach -t $1 || tmux new -s $1
}
_autocomplete_code()
{
local cur projects
[ -r "$CODE_DIR" ] || return 0
eval 'COMPREPLY=()'
cur=${COMP_WORDS[COMP_CWORD]}
projects=$(\ls "$CODE_DIR")
if [ $COMP_CWORD -eq 1 ]; then
eval 'COMPREPLY=( $(compgen -o filenames -W "$projects" $cur) )'
fi
return 0
}
complete -F _autocomplete_code code
# Add manger executables to PATH
PATH=$HOME/bin/:$PATH
# Add project-local node_module executables to PATH
export PATH="$PATH:./node_modules/.bin"
# Ruby-specific settings
export RUBY_YJIT_ENABLE=1
export RUBY_CONFIGURE_OPTS=--enable-yjit
# Load homebrew
[ -e "/opt/homebrew/bin/brew" ] && eval "$(/opt/homebrew/bin/brew shellenv)"
# Load asdf from either install method
[[ -s "$HOME/.asdf/asdf.sh" ]] && source "$HOME/.asdf/asdf.sh"
[[ -s "$HOME/.asdf/completions/asdf.bash" ]] && source "$HOME/.asdf/completions/asdf.bash"
[[ -s "/opt/homebrew/opt/asdf/libexec/asdf.sh" ]] && source "/opt/homebrew/opt/asdf/libexec/asdf.sh"
# Load a machine-specific .zshrc if present
[ -e "$HOME/.zshrc.local" ] && . "$HOME/.zshrc.local"