-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.zshrc
More file actions
139 lines (110 loc) · 4.33 KB
/
.zshrc
File metadata and controls
139 lines (110 loc) · 4.33 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
################################################################################
### ENVIRONMENT VARIABLES
################################################################################
export HOMEBREW_NO_ANALYTICS=1
export DISABLE_AUTO_UPDATE=true
export EDITOR="nvim"
export KUBE_EDITOR="nvim"
export GOROOT=/opt/homebrew/opt/go/libexec
export GOPATH=$HOME/go
export GO111MODULE=on
export NODE_OPTIONS="--dns-result-order=ipv4first"
export MANPAGER="nvim +Man!"
################################################################################
### ZSH CONFIGURATION
################################################################################
# Set the directory we want to store zinit and plugins
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git"
# Download Zinit, if it's not there yet
if [ ! -d "$ZINIT_HOME" ]; then
mkdir -p "$(dirname $ZINIT_HOME)"
git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME"
fi
# Source/Load zinit
source "${ZINIT_HOME}/zinit.zsh"
# Add in zsh plugins
zinit light zsh-users/zsh-completions
zinit light zsh-users/zsh-autosuggestions
zinit light Aloxaf/fzf-tab
# Load completions
autoload -Uz compinit && compinit
zinit cdreplay -q
# Keybindings
bindkey -v
bindkey "^[[A" history-beginning-search-backward
bindkey "^[[B" history-beginning-search-forward
bindkey "^[[1;3C" vi-forward-word
bindkey "^[f" vi-backward-word
bindkey "^[[1;3A" beginning-of-line
bindkey "^[[1;3B" end-of-line
# History
HISTSIZE=10000
HISTFILE=~/.zsh_history
SAVEHIST=$HISTSIZE
HISTDUP=erase
setopt appendhistory
setopt sharehistory
setopt hist_ignore_space
setopt hist_ignore_all_dups
setopt hist_save_no_dups
setopt hist_ignore_dups
setopt hist_find_no_dups
# Hidden files
setopt globdots
# Allow comments in interactive shells
setopt interactive_comments
# Completion styling
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
zstyle ':completion:*' menu no
zstyle ':fzf-tab:*' fzf-flags --color=bg+:#363a4f,bg:#24273a,spinner:#f4dbd6,hl:#ed8796 --color=fg:#cad3f5,header:#ed8796,info:#c6a0f6,pointer:#f4dbd6 --color=marker:#f4dbd6,fg+:#cad3f5,prompt:#c6a0f6,hl+:#ed8796
################################################################################
### FZF
################################################################################
eval "$(fzf --zsh)"
export FZF_DEFAULT_COMMAND='fd --full-path --hidden --color never --type f --exclude .git'
export FZF_DEFAULT_OPTS='--color=bg+:#363a4f,bg:#24273a,spinner:#f4dbd6,hl:#ed8796 --color=fg:#cad3f5,header:#ed8796,info:#c6a0f6,pointer:#f4dbd6 --color=marker:#f4dbd6,fg+:#cad3f5,prompt:#c6a0f6,hl+:#ed8796'
################################################################################
### ALIAS
################################################################################
alias vim="nvim"
alias vi="nvim"
alias ls='ls --color'
alias la='ls -la --color'
alias watch='watch '
alias k='kubectl'
alias chrome='/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222'
alias y='yazi'
################################################################################
### FUNCTIONS
################################################################################
websearch() { open -a "Google Chrome" "https://www.google.com/search?q=$(omz_urlencode -P $@)&udm=14"; }
cdp() {
REPOS=`find $HOME/Documents/GitHub -type d -maxdepth 2 -mindepth 2`
cd $(echo "/Users/ricoberger/Desktop\n/Users/ricoberger/Documents\n/Users/ricoberger/Downloads\n$REPOS" | fzf)
}
ksecret() {
kubectl get secret $@ -o go-template='{{range $k,$v := .data}}{{printf "%s: " $k}}{{if not $v}}{{$v}}{{else}}{{$v | base64decode}}{{end}}{{"\n"}}{{end}}'
}
vaultedit() {
TMPFILE=`mktemp /tmp/vaultsecret.XXXXXXXXX`
vault kv get -format=json $@ | jq .data.data > ${TMPFILE};
vim -c 'set ft=json' ${TMPFILE} < /dev/tty > /dev/tty
vault kv put $@ @${TMPFILE}
rm ${TMPFILE}
}
vaultcreate() {
TMPFILE=`mktemp /tmp/vaultsecret.XXXXXXXXX`
vim -c 'set ft=json' ${TMPFILE} < /dev/tty > /dev/tty
vault kv put $@ @${TMPFILE}
rm ${TMPFILE}
}
# See https://yazi-rs.github.io/docs/quick-start#shell-wrapper
yy() {
local tmp="$(mktemp -t "yazi-cwd.XXXXXX")" cwd
yazi "$@" --cwd-file="$tmp"
if cwd="$(command cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then
builtin cd -- "$cwd"
fi
rm -f -- "$tmp"
}