-
Notifications
You must be signed in to change notification settings - Fork 0
/
.zshrc
198 lines (165 loc) · 4.75 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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
###############
### General ###
###############
# Load colors
autoload -U colors && colors
for COLOR in RED GREEN YELLOW BLUE MAGENTA CYAN BLACK WHITE; do
eval $COLOR='$fg_no_bold[${(L)COLOR}]'
eval BOLD_$COLOR='$fg_bold[${(L)COLOR}]'
done
eval NC='$reset_color'
##################
### Completion ###
##################
# Load and initialise completion system
autoload -Uz compinit
zstyle ':completion:*' menu select
zmodload zsh/complist
compinit -d "$XDG_CACHE_HOME/zsh/.zshcompdump-$ZSH_VERSION"
_comp_options+=(globdots)
#######################
### Vim Mode Config ###
#######################
bindkey -v
export KEYTIMEOUT=7
# Use vim keys in tab complete menu:
bindkey -M menuselect 'h' vi-backward-char
bindkey -M menuselect 'k' vi-up-line-or-history
bindkey -M menuselect 'l' vi-forward-char
bindkey -M menuselect 'j' vi-down-line-or-history
bindkey -v '^?' backward-delete-char
# Change cursor shape for different vi modes.
function zle-keymap-select {
if [[ ${KEYMAP} == vicmd ]] ||
[[ $1 = 'block' ]]; then
echo -ne '\e[1 q'
elif [[ ${KEYMAP} == main ]] ||
[[ ${KEYMAP} == viins ]] ||
[[ ${KEYMAP} = '' ]] ||
[[ $1 = 'beam' ]]; then
echo -ne '\e[5 q'
fi
}
zle -N zle-keymap-select
zle-line-init() {
zle -K viins # initiate `vi insert` as keymap (can be removed if `bindkey -V` has been set elsewhere)
echo -ne "\e[5 q"
}
zle -N zle-line-init
echo -ne '\e[5 q' # Use beam shape cursor on startup.
preexec() { echo -ne '\e[5 q' ;} # Use beam shape cursor for each new prompt.
# ctrl-e: to edit command line in vim
autoload edit-command-line; zle -N edit-command-line
bindkey '^e' edit-command-line
##########################
### Zap Plugin Manager ###
##########################
[ -f "${XDG_DATA_HOME:-$HOME/.local/share}/zap/zap.zsh" ] && source "${XDG_DATA_HOME:-$HOME/.local/share}/zap/zap.zsh"
plug "zsh-users/zsh-autosuggestions"
plug "zap-zsh/supercharge"
plug "zsh-users/zsh-syntax-highlighting"
plug "hlissner/zsh-autopair"
plug "zsh-users/zsh-history-substring-search"
plug "MichaelAquilina/zsh-you-should-use"
plug "zap-zsh/completions"
plug "zap-zsh/sudo"
plug "web-search"
plug "zap-zsh/fzf"
plug "zap-zsh/web-search"
#######################
### Zedro's Scripts ###
#######################
# tmux
alias zmux=~/.dotfiles/scripts/tmux/zmux-init.sh
alias xmux=~/.dotfiles/scripts/tmux/zmux-kill.sh
# Screen Recording
# kill simplescreenrecorder
alias kill-screenrec=~/.dotfiles/scripts/i3/kill-screenrec.sh
# lulz
alias greet=~/.dotfiles/scripts/zsh/zsh-greet.sh
alias zshcow=~/.dotfiles/scripts/zsh/cowsay-fortune.sh
#################
### Greetings ###
#################
greet $HOST
################
### Keyboard ###
################
eval "setxkbmap us"
#######################
### Zedro's Aliases ###
#######################
# Compiling
alias ccw='cc -Wall -Wextra -Werror -g'
# 42 Norm Check
alias nn='norminette'
# Franinette alias
alias francinette=~/francinette/tester.sh
alias fr='francinette'
# Neovim
alias v='nvim'
alias vc='vim | lolcat'
alias clear_nvim='rm -rf ~/.local/share/nvim'
# git
alias ga='git add'
alias gst='git status'
alias gc='git commit -m'
alias gp='git push'
alias gl='git pull'
alias gco='git checkout'
alias gcb='git checkout -b'
alias glgg='git log --graph --oneline --decorate'
alias glgs='git log --graph --oneline --decorate | head -n 7'
alias gm='git merge --stat --log'
# kitty at 42
if [[ $USER == "passunca" || $USER == "zedr0" || $USER == "Zedro" ]]; then
alias kitty=~/.local/kitty.app/bin/kitty
fi
alias k='kitty --start-as=fullscreen'
alias icat='kitty +kitten icat'
alias kdiff='kitty +kitten diff'
# Glow Markdown Renderer
alias glow=~/bin/glow/glow
# File system Navigation
# cd || zoxide
if command -v zoxide > /dev/null 2>&1; then
eval "$(zoxide init --cmd cd zsh)"
echo "[Running ${GREEN}zoxide${NC}! 📂]"
else
echo "[Running ${YELLOW}cd${NC}! 📂]"
fi
# ls || eza
if command -v eza > /dev/null 2>&1; then
echo "[Running ${GREEN}eza${NC}! 📊]"
alias ls='eza'
alias ll='eza -laZ --total-size'
alias llg='eza -laZ --total-size --git --git-repos'
else
echo "[Running ${YELLOW}ls${NC}! ]"
alias ll='ls -al --color'
fi
# Load Cowsay
if command -v lolcat > /dev/null 2>&1; then
eval "zshcow" | lolcat
else
eval "zshcow"
fi
############################
### Load Starship Prompt ###
############################
if command -v starship > /dev/null 2>&1; then
eval "$(starship init zsh)"
else
ZSH_THEME="refined"
fi
#####################################
### Clear google-chrome Singleton* ###
#####################################
if [[ $USER == "passunca" ]]; then
rm -rf ~/.config/google-chrome/Singleton*
fi
alias m_test=~/Minishell_Tester/start.sh
alias reallyshell=~/Minishell_Tester/connect.sh
eval "$(atuin init zsh)"
# Set up fzf key bindings and fuzzy completion
source <(fzf --zsh)