-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zshrc
151 lines (114 loc) · 3.71 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
148
149
150
151
# =============================
# prompt
# =============================
THEME=catppuccin-mocha
setopt PROMPT_SUBST
NEWLINE=$'\n'
PS1="${NEWLINE}${NEWLINE} %B%K{green}%F{black} %~ %f%k %F{green}>%f%b "
if [[ "$THEME" = "catppuccin-mocha" ]]; then
PS1="${NEWLINE}${NEWLINE} %B%K{magenta}%F{black} %~ %f%k %F{magenta}>%f%b "
fi
# =============================
# env variables and options
# =============================
if [[ -f "$HOME/.env" ]]; then
source $HOME/.env
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
export PATH="$HOME/bin:$PATH"
fi
export AWS_PROFILE=non-prod
export AWS_DEFAULT_PROFILE=non-prod
export EDITOR=nvim
export BAT_THEME="$THEME"
export HISTFILE=~/.zsh_history
export HISTSIZE=10000
export SAVEHIST=10000
setopt INC_APPEND_HISTORY_TIME
bindkey "^P" up-line-or-search
bindkey "^N" down-line-or-search
bindkey -e
# =============================
# aliases
# =============================
function commit {
if [[ $# -eq 2 ]]; then
vcNum=$(git branch --show-current | grep -o -E '[0-9]+')
echo "\n$: git commit -m \"$1: vc-"$vcNum" $2\"\n"
git commit -m "$1: vc-"$vcNum" $2"
else
echo "Usage: commit [commit type] [commit message]"
fi
}
function newb {
if [[ $# -eq 3 ]]; then
echo "\n$: git checkout -b "$1/vc-$2_${3// /_}"\n"
git checkout -b "$1/vc-$2_${3// /_}"
else
echo "Usage: newb [branch type] [vc number] [branch description]"
fi
}
alias pushu="git push -u origin HEAD"
alias glog="git log --oneline "
alias gs="git status -sb"
alias gq="git checkout qa-test"
alias dotfiles='/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'
#alias bat="batcat"
alias cat="bat"
alias ls="eza --color=always --long --git --no-filesize --icons=always --no-time --no-user --group-directories-first"
# =============================
# plugins
# =============================
ZPLUGINDIR=$HOME/.zsh/plugins
if [[ ! -d $ZPLUGINDIR/zsh-autosuggestions ]]; then
git clone https://github.com/zsh-users/zsh-autosuggestions $ZPLUGINDIR/zsh-autosuggestions
fi
source $ZPLUGINDIR/zsh-autosuggestions/zsh-autosuggestions.plugin.zsh
bindkey '^y' autosuggest-accept
if [[ ! -d $ZPLUGINDIR/zsh-syntax-highlighting ]]; then
git clone https://github.com/zsh-users/zsh-syntax-highlighting $ZPLUGINDIR/zsh-syntax-highlighting
fi
source $ZPLUGINDIR/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
if [[ ! -d $ZPLUGINDIR/zsh-autopair ]]; then
git clone https://github.com/hlissner/zsh-autopair $ZPLUGINDIR/zsh-autopair
fi
source $ZPLUGINDIR/zsh-autopair/autopair.zsh
autopair-init
# =============================
# super important scripts
# =============================
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
source <(kubectl completion zsh)
neofetch
# =============================
# fzf configuration
# =============================
if [[ -d "$HOME/.fzf/bin" ]]; then
if [[ ! "$PATH" == "*$HOME/.fzf/bin*" ]]; then
PATH="${PATH:+${PATH}:}$HOME/.fzf/bin"
fi
fi
eval "$(fzf --zsh)"
function fzf_search_specific_dirs {
local selected_dir
selected_dir=$(find ~/repos ~/repos/rust-beginnings -maxdepth 1 -type d | fzf)
if [[ -n $selected_dir ]]; then
cd "$selected_dir" || return
fi
}
function fzf_search_git_branches {
local selected_branch
selected_branch=$(git branch --sort=-committerdate | fzf | tr -d ' ')
if [[ -n $selected_branch ]]; then
echo "\n$: git checkout "$selected_branch"\n"
git checkout "$selected_branch"
fi
}
bindkey -s ^f "fzf_search_specific_dirs\n"
bindkey -s ^b "fzf_search_git_branches\n"
if [[ "$(tty)" = "/dev/tty1" ]]; then
exec startx
fi