-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzshrc.symlink
216 lines (183 loc) · 6.64 KB
/
zshrc.symlink
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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
# 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
#####################
# FIRST PROMPT LINE #
#####################
NC='\e[0m'
echo -e "ZSH${NC} ${ZSH_VERSION}"
#####################
# ZINIT #
#####################
if [[ ! -f $HOME/.zinit/bin/zinit.zsh ]]; then
command mkdir -p $HOME/.zinit
command git clone https://github.com/zdharma-continuum/zinit $HOME/.zinit/bin
fi
source "$HOME/.zinit/bin/zinit.zsh"
#####################
# THEME #
#####################
zinit ice depth=1; zinit light romkatv/powerlevel10k
#####################
# PLUGINS #
#####################
# SYNTAX HIGHLIGHTING
zinit ice wait lucid atinit="zpcompinit;zpcdreplay"
zinit light zdharma-continuum/fast-syntax-highlighting
zinit wait lucid light-mode for \
atinit"zicompinit; zicdreplay" \
zdharma-continuum/fast-syntax-highlighting \
atload'_zsh_autosuggest_start; bindkey "^ " autosuggest-accept' \
zsh-users/zsh-autosuggestions \
blockf atpull'zinit creinstall -q .' \
zsh-users/zsh-completions
# TAB COMPLETIONS
zstyle ':completion:*' completer _expand _complete _ignored _approximate
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
zstyle ':completion:*:descriptions' format '-- %d --'
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
# FZF-TAB
zinit ice wait lucid
zinit light Aloxaf/fzf-tab
source /usr/share/doc/fzf/examples/key-bindings.zsh
source /usr/share/doc/fzf/examples/completion.zsh
# DELTA
zinit ice lucid wait="0" as="program" from="gh-r" bpick="*amd64.deb" pick="usr/bin/delta"
zinit light dandavison/delta
# GLOW
zinit ice lucid wait"0" as"program" from"gh-r" bpick='*linux_amd64.deb' pick"usr/bin/glow"
zinit light charmbracelet/glow
# ENHANCD
zinit ice wait="0" lucid
zinit light b4b4r07/enhancd
export ENHANCD_FILTER=fzf:fzy:peco
# CROC
zinit ice lucid wait="0" as="program" from="gh-r" bpick="*64bit*"
zinit light schollz/croc
# EXA
zinit ice wait="0" lucid from="gh-r" as="program" mv="bin/exa* -> exa"
zinit light ogham/exa
zinit ice wait blockf atpull'zinit creinstall -q .'
#####################
# HISTORY #
#####################
[ -z "$HISTFILE" ] && HISTFILE="$HOME/.zsh_history"
HISTSIZE=100000
SAVEHIST=$HISTSIZE
#####################
# SETOPT #
#####################
setopt extended_history # record timestamp of command in HISTFILE
setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE
setopt hist_ignore_all_dups # ignore duplicated commands history list
setopt hist_ignore_space # ignore commands that start with space
setopt hist_verify # show command with history expansion to user before running it
setopt inc_append_history # add commands to HISTFILE in order of execution
setopt share_history # share command history data
setopt always_to_end # cursor moved to the end in full completion when completing from the middle of a word, move the cursor to the end of the word
setopt complete_in_word # allow completion from within a word/phrase
setopt complete_aliases
setopt list_ambiguous # complete as much of a completion until it gets ambiguous.
setopt no_hup
setopt no_listbeep
# setopt nolisttypes
setopt listpacked
setopt automenu
unsetopt BEEP
setopt vi
#####################
# ENV VARIABLE #
#####################
export EDITOR='nvim'
export VISUAL=$EDITOR
export PAGER='less'
export SHELL='/bin/zsh'
export BAT_THEME="gruvbox-dark"
# export TERM='screen-256color'
# if [[ ! $(tmux ls) ]] 2> /dev/null; then
# tmux new -s λ
# fi
#####################
# COLORING #
#####################
# autoload colors && colors
# BAT
zinit ice from="gh-r" as="program" pick="usr/bin/bat" bpick="*amd64.deb" atload="alias cat=bat"
zinit light sharkdp/bat
# BAT-EXTRAS
zinit ice lucid wait="1" as="program" pick="src/batgrep.sh"
zinit ice lucid wait="1" as="program" pick="src/batdiff.sh"
zinit light eth-p/bat-extras
alias rg=batgrep.sh
alias bd=batdiff.sh
alias man=batman.sh
#####################
# FZF SETTINGS #
#####################
export FZF_DEFAULT_OPTS="
--layout=reverse
--info=inline
--height=50%
--multi
--preview-window=right
--preview '([[ -f {} ]] && (bat --style=numbers --color=always --theme=gruvbox-dark --line-range :500 {} || cat {})) || ([[ -d {} ]] && (tree -C {} | less)) || echo {} 2> /dev/null | head -200'
--bind 'ctrl-e:execute(nvim {} < /dev/tty > /dev/tty 2>&1)' > selected
--bind 'ctrl-v:execute(code {+})'"
export FZF_DEFAULT_COMMAND='rg --files --no-ignore --hidden --follow -g "!{.git,node_modules}/*" 2> /dev/null'
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
#####################
# PATH #
#####################
export PATH=$PATH:/usr/local/opt/grep/libexec/gnubin
export PATH=$PATH:/usr/local/sbin
export PATH=$PATH:$DOTFILES/bin
export PATH=$PATH:$HOME/.local/scripts
export PATH=$PATH:$HOME/.cargo/bin
export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin:~/.local/bin:~/bin
#####################
# P10K SETTINGS #
#####################
[[ -f ~/.p10k.zsh ]] && source ~/.p10k.zsh
# Z
. ~/z/z.sh
# Tmux sessionizer
bindkey -s ^f "tmux-sessionizer\n"
# Make lase word uppercase
bindkey -s ^o "^[bgUiwea"
########################################################
# Aliases
########################################################
# use nvim, but don't make me think about it
alias vi="nvim"
# Filesystem aliases
alias ..='cd ..'
alias ...='cd ../..'
alias ....="cd ../../.."
alias .....="cd ../../../.."
alias l="exa -laF --icons"
alias ld="exa -laD"
alias ltd="exa -lTFD --git-ignore"
alias lt="exa -lTF --git-ignore --icons"
alias lta="exa -laTF --git-ignore --icons -I .git"
alias rmf="rm -rf"
# Recursively delete `.DS_Store` files
alias cleanup="find . -name '*.DS_Store' -type f -ls -delete"
# remove broken symlinks
alias clsym="find -L . -name . -o -type d -prune -o -type l -exec rm {} +"
# tmux aliases
alias ta='tmux attach'
# Open browser from wsl
if [[ $(uname -r) =~ WSL ]]; then
alias open='wslview'
export BROWSER=wslview
fi
export DOTFILES="$HOME/.dotfiles"
export DOCUMENTS='/mnt/c/Documents and Settings/Franc/Documents'
export DOWNLOADS='/mnt/c/Documents and Settings/Franc/Downloads'
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
PATH=~/.local/bin:$PATH