-
Notifications
You must be signed in to change notification settings - Fork 0
/
.zshrc
147 lines (116 loc) · 4.7 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
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
142
143
144
145
146
147
# Start tmux on initialization.
if [[ -z "$TMUX" && "$TERM_PROGRAM" != "vscode" ]]
then
tmux -u attach -t TMUX || tmux -u new -s TMUX
fi
# 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
# If you come from bash you might have to change your $PATH.
export PATH="$HOME/.local/bin:$PATH"
# Path to your oh-my-zsh installation.
export ZSH="/Users/petr/.oh-my-zsh"
ZSH_THEME="powerlevel10k/powerlevel10k"
ZSH_DISABLE_COMPFIX="true"
DISABLE_UNTRACKED_FILES_DIRTY="true"
# Path to hombrew binary
export PATH="/opt/homebrew/bin:$PATH"
# Which plugins would you like to load?
# Standard plugins can be found in $ZSH/plugins/
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(
autojump
docker
docker-compose
git
git-extras
git-auto-fetch
gh
history
nvm
sudo
tmux
fzf-tab
)
source $ZSH/oh-my-zsh.sh
source /opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source /opt/homebrew/share/zsh-autosuggestions/zsh-autosuggestions.zsh
[ -f /opt/homebrew/etc/profile.d/autojump.sh ] && . /opt/homebrew/etc/profile.d/autojump.sh
export NVM_DIR="$HOME/.nvm"
[ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && . "/opt/homebrew/opt/nvm/nvm.sh" # This loads nvm
[ -s "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" ] && . "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion
# pnpm
export PNPM_HOME="/Users/petr/Library/pnpm"
export PATH="$PNPM_HOME:$PATH"
# --------------------------- Custom aliases ----------------------------------
# UPGRADE ALL!
alias all-up="mas-up; brew-up; brew-cl; brew-dc; zsh-up; ;lvim-up; nvm-up; npm-up; pnpm-up; pip-up; nvm-cl; npm-cv; pnpm-cl; gh-up; pip-cl; code-cl; clr; zsh-rr;"
# MacOS
alias mac-up="sudo softwareupdate -i -a --restart"
alias mas-up="mas upgrade"
# brew
alias brew-up="brew update; brew upgrade; brew upgrade --cask; brew cu -a -y"
alias brew-cl="brew cleanup -s; brew autoremove"
alias brew-dc="brew doctor; brew missing"
# zsh
alias zsh-cfg="code ~/.zshrc"
alias zsh-rr="exec zsh"
alias zsh-up="omz update --unattended; p10k-up; fzf-tab-up"
alias zsh-hs="mv ~/.zsh_history ~/.zsh_history_bad && strings ~/.zsh_history_bad > ~/.zsh_history && fc -R ~/.zsh_history && rm ~/.zsh_history_bad"
alias p10k-up="git -C ~/.oh-my-zsh/custom/themes/powerlevel10k pull --rebase"
alias fzf-tab-up="git -C ~/.oh-my-zsh/custom/plugins/fzf-tab pull --rebase"
# nvm
alias nvm-up="nvm install 'lts/*' --reinstall-packages-from=current"
alias nvm-cl="nvm cache clear"
# npm
alias npm-ls="npm list -g --depth=0"
alias npm-up="npm update -g"
alias npm-cv="npm cache verify"
# pnpm
alias pnpm-up="pnpm add -g pnpm && pnpm update -g"
alias pnpm-cl="pnpm store prune"
# GitHub CLI
alias gh-up="gh extension upgrade --all"
# pip
alias pip-up="python3 -m pip install --upgrade pip; pip list --outdated --format=json | jq -r '.[] | .name+\"=\"+.latest_version'"
alias pip-cl="pip3 cache purge"
# lvim
alias lvim-up="lvim +LvimUpdate +q"
# Basic bash aliases
alias clr="clear"
alias cd..="cd .."
alias c="code"
alias df='/opt/homebrew/bin/git --git-dir=$HOME/.dotfiles --work-tree=$HOME'
alias dev="cd ~/dev"
alias work="cd ~/dev/economia"
alias vpn="sudo openfortivpn"
# Scripts
alias code-cl="sh ~/dev/scripts/vscode-unused-workspace-storage-cleanup.sh"
alias slc="cd ~; python3 ~/dev/scripts/calc.py"
# git
alias uncommit="git reset HEAD~1"
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
autoload -U +X bashcompinit && bashcompinit
complete -o nospace -C /home/petr/go/bin/bit bit
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
# Initialize fzf-tab/tmux popup
zstyle ':fzf-tab:*' fzf-command ftb-tmux-popup
# disable sort when completing `git checkout`
zstyle ':completion:*:git-checkout:*' sort false
# set descriptions format to enable group support
zstyle ':completion:*:descriptions' format '[%d]'
# set list-colors to enable filename colorizing
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
# preview directory's content with exa when completing cd
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'exa -1 --color=always $realpath'
# switch group using `,` and `.`
zstyle ':fzf-tab:*' switch-group ',' '.'
# set popup-pad values
zstyle ':fzf-tab:complete:cd:*' popup-pad 50 0