-
Notifications
You must be signed in to change notification settings - Fork 0
/
.zshrc
144 lines (126 loc) · 3.92 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
#-------------------------------------------------------------------------------
# Core ZSH Configuration
#-------------------------------------------------------------------------------
autoload -U compinit; compinit
autoload edit-command-line; zle -N edit-command-line
# Vi mode bindings
bindkey -M vicmd 'v' edit-command-line
bindkey '^Xe' edit-command-line
#-------------------------------------------------------------------------------
# Environment Variables
#-------------------------------------------------------------------------------
export VISUAL=nvim
export EDITOR=nvim
export evs=~/ev/scripts
export BAT_THEME="Monokai Extended"
#-------------------------------------------------------------------------------
# General Aliases
#-------------------------------------------------------------------------------
alias cls="clear && printf '\e[3J'"
alias l="ls"
alias ll="ls -al"
alias c="clear"
alias rsrc="source ~/.zshrc"
alias :q="exit"
alias theme="sh ~/dotfiles/scripts/toggle.sh"
# Modern replacements
alias cat="bat"
alias diff="difft"
alias ls="eza"
alias t="eza -T"
alias vim="nvim"
alias v="nvim"
alias cd="z"
# Common shortcuts
alias p="pbpaste"
alias o="open ."
alias tf="terraform"
alias ns="npm start"
alias nr="npm run"
alias pn="pnpm"
alias br="bin/rails"
#-------------------------------------------------------------------------------
# Navigation Aliases
#-------------------------------------------------------------------------------
alias ~="cd ~"
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
#-------------------------------------------------------------------------------
# Docker Aliases
#-------------------------------------------------------------------------------
alias d="docker"
alias dc="docker compose"
alias dcu="docker compose up"
alias dcd="docker compose down"
alias dcb="docker compose build"
#-------------------------------------------------------------------------------
# Git Aliases & Functions
#-------------------------------------------------------------------------------
alias g='git'
alias ga='git add'
alias gaa='git add .'
alias gaaa='git add -A'
alias gc='git commit'
alias gcl='git clone'
alias gch='git checkout'
alias gcm='git commit -m'
alias gd='git diff'
alias gi='git init'
alias gl='git log'
alias gp='git pull'
alias gpsh='git push'
alias gpshu='git push --set-upstream origin master'
alias gss='git status -s'
alias gs='git status'
alias gm="git rm --cached"
alias gv="git remote get-url origin | xargs open $1"
alias gpo='git push origin "$(git symbolic-ref --short HEAD)"'
alias grv="git reset --hard"
alias gb="git branch"
alias gsw="git switch"
alias gsh="git show"
alias gcp="git cherry-pick"
alias cpb="git symbolic-ref --short HEAD | pbcopy "
alias branch="git branch | grep -v \"^\*\" | fzf --height=20% --reverse --info=inline | xargs git checkout"
alias cppb="git rev-parse --symbolic-full-name --abbrev-ref=loose @{-1}"
# Git Functions
function gitlazy() {
git add .
git commit -a -m "$1"
git push
}
function gitback() {
git stash
git checkout main
git pull
git checkout -b $1
git stash pop
}
#-------------------------------------------------------------------------------
# Utility Functions
#-------------------------------------------------------------------------------
function mkcd() {
mkdir $1
cd $1
}
#-------------------------------------------------------------------------------
# Tool Initializations
#-------------------------------------------------------------------------------
# Starship prompt
eval "$(starship init zsh)"
# PyEnv
if command -v pyenv 1>/dev/null 2>&1; then
eval "$(pyenv init -)"
fi
# FZF
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
source ~/.config/fzf-tab/fzf-tab.plugin.zsh
zstyle ':fzf-tab:*' fzf-command ftb-tmux-popup
# Atuin shell history
eval "$(atuin init zsh --disable-up-arrow)"
# ZSH plugins
source /opt/homebrew/share/zsh-autosuggestions/zsh-autosuggestions.zsh
# Zoxide
eval "$(zoxide init zsh)"