-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zshrc
99 lines (81 loc) · 3.21 KB
/
.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
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
# Environment variables
export EDITOR='nvim'
export LC_ALL='en_US.UTF-8'
export LANG='en_US.UTF-8'
export PATH="${HOME}/bin:${HOME}/go/bin:${PATH}"
export FZF_DEFAULT_COMMAND='fd --type f --strip-cwd-prefix --hidden --follow --exclude .git'
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
# Save history to log files
# See https://www.justinjoyce.dev/save-your-shell-history-to-log-files/
preexec() {if [ "$(id -u)" -ne 0 ]; then echo "$(date "+%Y-%m-%d.%H:%M:%S") $(pwd) $ $3" >> ~/.logs/zsh-history-$(date "+%Y-%m-%d").log; fi}
# Version managers
# fnm
eval "$(fnm env --use-on-cd --version-file-strategy=recursive)"
# pyenv
export PYENV_ROOT="$HOME/.pyenv"
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
# rbenv
eval "$(rbenv init - zsh)"
# zinit - zsh plugin manager
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git"
[ ! -d $ZINIT_HOME ] && mkdir -p "$(dirname $ZINIT_HOME)"
[ ! -d $ZINIT_HOME/.git ] && git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME"
source "${ZINIT_HOME}/zinit.zsh"
# Plugins
zinit light zsh-users/zsh-autosuggestions
zinit light zsh-users/zsh-completions
zinit light zsh-users/zsh-syntax-highlighting
zinit snippet OMZL::directories.zsh # directory aliases
zinit snippet OMZL::completion.zsh # tab to highlight
zinit snippet OMZL::history.zsh # shared history across sessions
zinit snippet OMZL::key-bindings.zsh # terminal shortcuts like C-a and C-e
zinit snippet OMZL::functions.zsh # adds take function
zinit snippet OMZL::git.zsh # all the git goodies
zinit snippet OMZP::aws
zinit snippet OMZP::colored-man-pages
zinit snippet OMZP::fzf
zinit snippet OMZP::git
zinit snippet OMZP::yarn
zinit snippet OMZP::z
# Load direnv
zinit ice as"program" make'!' atclone'./direnv hook zsh > zhook.zsh' \
atpull'%atclone' src"zhook.zsh"
zinit light direnv/direnv
# Load powerlevel10k theme
zinit ice depth=1
zinit light romkatv/powerlevel10k
# Load Zsh completions
autoload -Uz compinit && compinit
# Load Bash-style completions
autoload -U +X bashcompinit && bashcompinit
# Load terraform completions
complete -o nospace -C /opt/homebrew/bin/terraform terraform
# Load all the completions
zinit cdreplay -q
# Custom Aliases
alias ls='lsd'
alias tree='lsd --tree'
alias up='brew update && brew upgrade'
alias gdcp='git --no-pager diff | pbcopy'
alias vim='nvim'
alias drs='docker stop $(docker ps -a -q) && docker rm $(docker ps -a -q)'
alias dco='docker compose'
alias lg='lazygit'
alias gt='git trim --no-confirm && git trim -d stray --no-confirm'
alias t='tmux'
alias tl='tmux list-sessions'
alias ts='tmux new-session'
alias ta='tmux attach'
alias tp='tmuxp load'
alias tf='terraform'
alias icat="kitten icat"
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh