-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzshrc
112 lines (102 loc) · 3.9 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
# plugins
# ------------------------------------------------------------------------------
# export DISPLAY=""
if [[ ! -d ~/.zplug ]];then
git clone https://github.com/b4b4r07/zplug ~/.zplug
fi
source ~/.zplug/init.zsh
# clipboard
export ZSH_SYSTEM_CLIPBOARD_USE_WL_CLIPBOARD
# zplug "kutsan/zsh-system-clipboard"
zplug "dylantjb/zsh-system-clipboard", at:patch-1 # needed for wayland until the PR is merged
# vim mode
zplug "softmoth/zsh-vim-mode"
if ! zplug check --verbose; then
printf "Install? [y/N]: "
if read -q; then
echo; zplug install
fi
fi
zplug load
# alias
# ------------------------------------------------------------------------------
if [ "$(uname)" = "Darwin" ]; then
alias ls="ls -lGh"
elif [ "$(uname)" = "Linux" ]; then
alias ls="ls --color -lh"
fi
alias la="ls -a"
alias clear="printf \"\\033c\""
alias clr=clear
alias rr=ranger
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
# vim
# ------------------------------------------------------------------------------
export KEYTIMEOUT=10 # timeoutlen centiseconds
leader=" "
autoload -U edit-command-line # open command in vim
zle -N edit-command-line
bindkey -M vicmd ' ' edit-command-line
bindkey -M viins 'jk' vi-cmd-mode
bindkey -M viins 'kj' vi-cmd-mode # back to normal mode
bindkey -M viins 'JK' vi-cmd-mode
bindkey -M viins 'KJ' vi-cmd-mode
bindkey -sM viins '^T' '^[viw~ea' # toggle caps
bindkey -sM vicmd '^T' 'viw~e'
bindkey -sM vicmd 'L' 'xp' # shift character right
bindkey -sM vicmd 'H' 'xhP'
bindkey -sM vicmd $leader'i' 'i?^[r' # insert single character
bindkey -sM vicmd $leader'a' 'a?^[r'
bindkey -sM vicmd $leader'o' 'o^[' # insert blank line
bindkey -sM vicmd $leader'O' 'O^['
bindkey -sM visual '^M' '^[' # exit visual with return
# completion
# ------------------------------------------------------------------------------
zstyle ':completion:*' completer _expand _complete _ignored _approximate
zstyle ':completion:*' matcher-list 'm:{[:lower:]}={[:upper:]} r:|[._-]=* r:|=*' \
'm:{[:lower:]}={[:upper:]}' '' 'm:{[:lower:]}={[:upper:]}'
zstyle ':completion:*' use-compctl false
zstyle :compinstall filename '$HOME/.zshrc'
autoload -Uz compinit
compinit
# Customization
# ------------------------------------------------------------------------------
# Color palette taken from vim-airline-bubblegum
GUI_DARK_GRAY='#303030'
GUI_MED_GRAY_HI='#444444'
GUI_MED_GRAY_LO='#3a3a3a'
GUI_LIGHT_GRAY='#b2b2b2'
GUI_GREEN='#afd787'
GUI_BLUE='#87afd7'
GUI_PURPLE='#afafd7'
GUI_ORANGE='#d7af5f'
GUI_RED='#d78787'
GUI_PINK='#d7afd7'
CTERM_DARK_GRAY=236
CTERM_MED_GRAY_HI=238
CTERM_MED_GRAY_LO=237
CTERM_LIGHT_GRAY=249
CTERM_GREEN=150
CTERM_BLUE=110
CTERM_PURPLE=146
CTERM_ORANGE=179
CTERM_RED=174
CTERM_PINK=182
MODE_INDICATOR_VIINS="%B%F{$CTERM_BLUE}INSERT%b%f"
MODE_INDICATOR_REPLACE="%B%F{$CTERM_RED}REPLACE%b%f"
MODE_INDICATOR_VICMD="%B%F{$CTERM_GREEN}NORMAL%b%f"
MODE_INDICATOR_SEARCH="%B%F{$CTERM_PURPLE}SEARCH%b%f"
MODE_INDICATOR_VISUAL="%B%F{$CTERM_PINK}VISUAL%b%f"
MODE_INDICATOR_VLINE="%B%F{$CTERM_PINK}V-LINE%b%f"
MODE_CURSOR_VIINS="$GUI_BLUE blinking bar"
MODE_CURSOR_REPLACE="$GUI_RED ff0000 steady underline"
MODE_CURSOR_VICMD="$GUI_GREEN steady block"
MODE_CURSOR_SEARCH="$GUI_PURPLE steady underline"
MODE_CURSOR_VISUAL="$GUI_PINK steady block"
MODE_CURSOR_VLINE="$GUI_PINK steady block"
# expands functions in prompt
setopt PROMPT_SUBST
PROMPT=' %F{$CTERM_PURPLE}%n%f [${MODE_INDICATOR_PROMPT}] %F{$CTERM_RED}>%f '
RPROMPT=' %F{$CTERM_RED}<%f %F{$CTERM_PURPLE%~%f'