-
Notifications
You must be signed in to change notification settings - Fork 0
/
dot_zshrc
129 lines (103 loc) · 3.5 KB
/
dot_zshrc
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
# zshrc Tom Preston
# Profile this startup (put `zprof` at the end)
#zmodload zsh/zprof
# Functions / aliases.
# Don't over do it, otherwise you'll lose muscle memory for the defaults.
# source file if it exists
function sourcefile() {
if [ -s $1 ]; then
source $1
fi
}
# Docker run some image as an env
function dr() {
local image="$1"
docker run \
-v "$PWD:/w" \
--workdir /w \
-it "${image}" \
/bin/bash
}
# Set Neovim as preferred editor
export VIMCONFIG="$HOME/.config/nvim"
export VIMDATA="$HOME/.local/share/nvim"
# If we're in the nvim terminal, use nvr
if [ -n "$NVIM" ]; then
if [ -x "$(command -v nvr)" ]; then
alias nvim=nvr
alias vim=nvr
alias vi=nvr
else
alias nvim='echo "No nesting!"'
alias vim='echo "No nesting!"'
alias vi='echo "No nesting!"'
fi
else
export VISUAL="nvim"
alias vim="$VISUAL"
alias vi="$VISUAL"
fi
export FZF_DEFAULT_COMMAND="rg --files"
# Use Neovim instead of vim or vi
# Open the vim configs
alias vimconf="$VISUAL $VIMCONFIG/init.lua"
# Use emacs keybindings, which I'm used to
bindkey -e
autoload -U edit-command-line
zle -N edit-command-line
bindkey '^x^e' edit-command-line
alias cdw="cd ~/src/github.com/monzo/wearedev"
alias cdd="cd ~/Downloads"
alias todo="vim ~/Documents/todo.md"
alias eod="open https://docs.google.com/document/d/1kBld3aUUazEdx-tK-YNUholDqxMon4LuVqGytgQpYPU/edit"
alias brag="open https://docs.google.com/document/d/1CB8e5D6PAZU6YtRIW2Ic0gSOZlwfHbtiJj2EbN5Jf_8/edit"
alias jn="open https://docs.google.com/document/d/1ZdQ7HEUv5xqDOYGkemFH9RLcNwljpnPwck6Hh9Sf-6M/edit"
alias grep="grep --color=auto"
alias la="ls -A"
alias ll="ls -l"
alias ls="ls -G"
alias l="ls -CF"
# Kubernetes completion (adds latency)
if type kubectl >/dev/null; then
autoload -U +X compinit && compinit
source <(kubectl completion zsh)
alias k="kubectl"
fi
# Bash-like navigation
autoload -U select-word-style
select-word-style bash
# Set the prompt
PROMPT='%n %3~ %# '
sourcefile ~/.fzf.zsh
# Monzo stuff
sourcefile "$HOME/src/github.com/monzo/starter-pack/zshrc"
# NVM settings (adds latency)
export NVM_DIR="$HOME/.nvm"
sourcefile "/usr/local/opt/nvm/nvm.sh"
sourcefile "/usr/local/opt/nvm/etc/bash_completion.d/nvm"
# Set up SSH AUTH SOCK if not already set up
# TODO delete if we don't need this, ignoring until I see the problem again
#export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
#if [ -z $(pgrep gpg-agent) ]; then
# gpg-agent --daemon
#fi
# TODO figure out why this is
eval $(ssh-agent) > /dev/null
export PATH="$HOME/Library/Python/3.10/bin:$PATH"
# Export tail
# Random setup scripts like to append here.
#
# This already happens in starter-pack
#export PYENV_ROOT=$(brew --prefix)/var/pyenv
#export PATH=$PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH
#if command -v pyenv 1>/dev/null 2>&1; then eval "$(pyenv init -)"; fi
export PATH="$HOME/.poetry/bin:$PATH"
export PATH="${CURRENT_USER}/.poetry/bin:$PATH"
sourcefile /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.zsh.inc
sourcefile /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.zsh.inc
export OAUTHLIB_RELAX_TOKEN_SCOPE=1
sourcefile "$HOME/src/github.com/monzo/analytics/dbt/misc/shell/source.sh"
# The next line updates PATH for the Google Cloud SDK.
if [ -f '/Users/tompreston/google-cloud-sdk/path.zsh.inc' ]; then . '/Users/tompreston/google-cloud-sdk/path.zsh.inc'; fi
# The next line enables shell command completion for gcloud.
if [ -f '/Users/tompreston/google-cloud-sdk/completion.zsh.inc' ]; then . '/Users/tompreston/google-cloud-sdk/completion.zsh.inc'; fi