-
Notifications
You must be signed in to change notification settings - Fork 0
/
private_dot_zshrc
140 lines (108 loc) · 3.44 KB
/
private_dot_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
[[ $- != *i* ]] && return
[[ "$(whoami)" = "root" ]] && return
PS1='%n@%m %~ $ '
[[ -z "$FUNCNEST" ]] && export FUNCNEST=100 # limits recursive functions, see 'man bash'
HISTFILE=~/.histfile
HISTSIZE=500000
HISTORY_IGNORE='sgpt *'
HIST_NO_STORE='sgpt *'
SAVEHIST=$HISTSIZE
zshaddhistory() {
whence ${${(z)1}[1]} >| /dev/null || return 1
}
bindkey -v
autoload -U compinit; compinit
zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}' 'r:|=*' 'l:|=* r:|=*'
# Clear terminal Ctrl+l
scroll-and-clear-screen() {
printf '\n%.0s' {1..$LINES}
zle clear-screen
}
zle -N scroll-and-clear-screen
bindkey '^l' scroll-and-clear-screen
# because it's required for share_history.
setopt append_history
# import new commands from the history file also in other zsh-session
setopt inc_append_history
setopt share_history
# save each command's beginning timestamp and the duration to the history file
setopt extended_history
# If a new command line being added to the history list duplicates an older
# one, the older command is removed from the list
setopt histignorealldups
# Expire duplicate entries first when trimming history.
setopt hist_expire_dups_first
# Don't record an entry that was just recorded again.
setopt hist_ignore_dups
# Don't write duplicate entries in the history file.
setopt hist_save_no_dups
# remove command lines from the history list when the first character on the
# line is a space
setopt histignorespace
export DIRENV_LOG_FORMAT=""
eval "$(direnv hook zsh)"
eval "$(starship init zsh)"
source ~/.aliases
if [ -f "$HOME/.secrets" ]; then
source $HOME/.secrets
fi
source /usr/share/zsh/plugins/zsh-vi-mode/zsh-vi-mode.plugin.zsh
# zsh vi mode
# Only changing the escape key to `jk` in insert mode, we still
# keep using the default keybindings `^[` in other modes
# ZVM_VI_INSERT_ESCAPE_BINDKEY=rt
my_zvm_vi_yank() {
zvm_vi_yank
echo -en "${CUTBUFFER}" | wl-copy
zvm_exit_visual_mode
}
my_zvm_vi_delete() {
zvm_vi_delete
echo -en "${CUTBUFFER}" | wl-copy
zvm_exit_visual_mode
}
my_zvm_vi_change() {
zvm_vi_change
echo -en "${CUTBUFFER}" | wl-copy
zvm_exit_visual_mode
}
my_zvm_vi_change_eol() {
zvm_vi_change_eol
echo -en "${CUTBUFFER}" | wl-copy
zvm_exit_visual_mode
}
my_zvm_vi_put_after() {
CUTBUFFER=$(wl-paste)
zvm_vi_put_after
zvm_highlight clear # zvm_vi_put_after introduces weird highlighting for me
zvm_exit_visual_mode
}
my_zvm_vi_put_before() {
CUTBUFFER=$(wl-paste)
zvm_vi_put_before
zvm_highlight clear # zvm_vi_put_before introduces weird highlighting for me
zvm_exit_visual_mode
}
zvm_after_lazy_keybindings() {
zvm_define_widget my_zvm_vi_yank
zvm_define_widget my_zvm_vi_delete
zvm_define_widget my_zvm_vi_change
zvm_define_widget my_zvm_vi_change_eol
zvm_define_widget my_zvm_vi_put_after
zvm_define_widget my_zvm_vi_put_before
zvm_bindkey visual 'y' my_zvm_vi_yank
zvm_bindkey visual 'd' my_zvm_vi_delete
zvm_bindkey visual 'x' my_zvm_vi_delete
zvm_bindkey vicmd 'C' my_zvm_vi_change_eol
zvm_bindkey visual 'c' my_zvm_vi_change
zvm_bindkey vicmd 'p' my_zvm_vi_put_after
zvm_bindkey vicmd 'P' my_zvm_vi_put_before
}
# add ssh keys to ssh agent
ssh-add
# init node version manager
source /usr/share/nvm/init-nvm.sh
# autosuggestion plugin
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.plugin.zsh
# highlight plugin
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.plugin.zsh