-
Notifications
You must be signed in to change notification settings - Fork 0
/
zshrc
124 lines (107 loc) · 3.33 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
# vim: set foldmethod=marker:
# {{{ EXPORTS
export EDITOR=nvim
# Highlights anything with main.* as purple to exa, and any directory as blue
# and bold
export EXA_COLORS='di=34;1:main.*=35'
# Changes man pages to be viewed with bat
export MANPAGER='sh -c "col -bx | bat --language man --plain"'
export ZSH_PLUGINS_ALIAS_TIPS_EXCLUDES='gorm gor'
# Mail goes to ~/.mbox instead of ~/mbox, less home directory clutter
export MBOX="$HOME/.mbox"
export FZF_DEFAULT_COMMAND='fd --type file --hidden'
export FZF_DEFAULT_OPTS="\
--preview-window=up \
--color='pointer:#00FFFF,prompt:#0db9d7,bg+:#263c42,hl+:#c19eff,hl:#b38aff,info:#75bf7a,border:#4f4970' \
--black \
--bind='ctrl-f:preview-half-page-down,ctrl-b:preview-half-page-up'"
export FZF_ALT_C_COMMAND='fd --type directory --hidden'
export FZF_COMPLETION_TRIGGER=']]'
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_DATA_HOME="$HOME/.local/share"
export PATH="$HOME/.cargo/bin:$PATH:$HOME/.dotfiles/zsh/autoload"
ZSH_THEME=kennethreitz
# }}}
# {{{ SETUPS
export ZSH="$HOME/.oh-my-zsh"
plugins=(
zsh-autosuggestions
almostontop
zoxide
autoupdate
copybuffer
zsh-autopair
zsh-syntax-highlighting
)
source $ZSH/oh-my-zsh.sh
eval "$(zoxide init zsh --cmd j)"
# }}}
# {{{ OPTIONS
setopt NO_NOMATCH
setopt NOTIFY
# }}}
# {{{ BINDKEYS & ZLE
# Maps jk to normal mode in the zsh line editor
bindkey jk vi-cmd-mode
# Binds shift-tab to accept autosuggestions
bindkey '^[[Z' autosuggest-accept
# Clears the prompt, writes the text, and enters it
bindkey -s 'uu' '^Ucd ..^M'
# Alt-l to complete
bindkey '^[l' expand-or-complete
bindkey '^[l' fzf-completion
# Copies current prompt text to clipboard
bindkey -M viins '^Y' copybuffer
bindkey -M vicmd '^Y' copybuffer
bindkey -M emacs '^Y' copybuffer
function zle-keymap-select {
# Change cursor for depending on the mode
if [[ ${KEYMAP} == vicmd ]] || [[ $1 = 'block' ]]; then
echo -ne '\e[2 q'
elif [[ ${KEYMAP} == main ]] ||
[[ ${KEYMAP} == viins ]] ||
[[ ${KEYMAP} = '' ]] ||
[[ $1 = 'beam' ]]; then
echo -ne '\e[6 q'
fi
}
zle -N zle-keymap-select
# }}}
# {{{ FUNCTIONS
source "$HOME/.dotfiles/zsh/functions.zsh"
# }}}
# {{{ HIGHLIGHT STYLES
# https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters/main.md
# for all possible highlight options
typeset -A ZSH_HIGHLIGHT_STYLES
# Modifiers like sudo and command
ZSH_HIGHLIGHT_STYLES[precommand]="fg=cyan,underline"
# The main part of commands
ZSH_HIGHLIGHT_STYLES[arg0]="fg=green,bold"
# Keywords like for and if (purple)
ZSH_HIGHLIGHT_STYLES[reserved-word]='fg=magenta'
# 'string', "string", and $"string"
ZSH_HIGHLIGHT_STYLES[single-quoted-argument]='fg=green'
ZSH_HIGHLIGHT_STYLES[double-quoted-argument]='fg=green'
ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]='fg=green'
ZSH_HIGHLIGHT_STYLES[single-hyphen-option]='fg=blue'
ZSH_HIGHLIGHT_STYLES[double-hyphen-option]='fg=blue'
# 'string and "string (red)
ZSH_HIGHLIGHT_STYLES[single-quoted-argument-unclosed]='fg=red'
ZSH_HIGHLIGHT_STYLES[double-quoted-argument-unclosed]='fg=red'
# }}}
# {{{ MISC
() {
readonly local CRON_FILE="$HOME/.dotfiles/setup/resources/crontab"
# Modeline to set syntax
echo "# vim:syntax=crontab\n" > $CRON_FILE
# Puts crontab into cron.txt
crontab -l >> $CRON_FILE
}
() {
local file
for file in ~/.dotfiles/zsh/aliases/*; do
source $file
done
}
# }}}