-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathzshrc
130 lines (97 loc) · 3.12 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
echo Hi from ~/.zshrc
emulate -LR zsh
. "$HOME/.cargo/env"
. $HOME/.aliases.sh
# enable completions
autoload -Uz compinit && compinit
# Download Znap, if it's not there yet.
[[ -f ~/Git/zsh-snap/znap.zsh ]] ||
git clone --depth 1 -- \
https://github.com/marlonrichert/zsh-snap.git ~/Git/zsh-snap
source ~/Git/zsh-snap/znap.zsh # Start Znap
znap eval starship 'starship init zsh --print-full-init'
prompt_starship_precmd
znap prompt # sindresorhus/pure
# for autocomplete
# zstyle ':autocomplete:*' min-input 3
# zstyle ':autocomplete:*' widget-style menu-select
bindkey -M vicmd '\e.' insert-last-word
bindkey -M viins '\e.' insert-last-word
# `znap source` automatically downloads and starts your plugins.
# znap source marlonrichert/zsh-autocomplete
znap source zsh-users/zsh-autosuggestions
znap source z-shell/fast-syntax-highlighting
# znap source zsh-users/zsh-syntax-highlighting
# znap source jeffreytse/zsh-vi-mode
# set emacs key mode so it doesnt eat ctrl+R
bindkey -v
setopt NO_CASE_GLOB
setopt AUTO_PUSHD
setopt CORRECT
setopt CORRECT_ALL
setopt APPEND_HISTORY
setopt EXTENDED_HISTORY
setopt INC_APPEND_HISTORY_TIME
setopt HIST_EXPIRE_DUPS_FIRST
setopt HIST_FIND_NO_DUPS
setopt HIST_REDUCE_BLANKS
setopt HIST_VERIFY
export HISTSIZE=100000
export SAVEHIST=100000
# allows carat to work for git stuff
setopt NO_NOMATCH
setopt AUTO_CD
# allow ctrl+s to work
stty -ixon
stty -ixoff
# delete
bindkey "\e[3~" delete-char
# ctrl delete
bindkey "\e[3;5~" kill-word
# shift delete
bindkey "\e[3;3~" kill-word
# opt? backspace
bindkey "\e" backward-delete-word
# I think this is ctrl application keypad mode or something????
bindkey "\eOc" forward-word
bindkey "\eOd" backward-word
# ctrl left/right
bindkey "\e[1;5C" forward-word
bindkey "\e[1;5D" backward-word
# ctrl up/down
bindkey "\e[1;5A" beginning-of-line
bindkey "\e[1;5B" end-of-line
# alt
bindkey "\e[1;3C" forward-word
bindkey "\e[1;3D" backward-word
# alt up/down
bindkey "\e[1;3A" beginning-of-line
bindkey "\e[1;3B" end-of-line
# shift
bindkey "\e[1;2C" forward-word
bindkey "\e[1;2D" backward-word
bindkey "\e[5C" forward-word
bindkey "\e[5D" backward-word
bindkey "\e\e[C" forward-word
bindkey "\e\e[D" backward-word
# home/end
bindkey "\e[1~" beginning-of-line
bindkey "\e[4~" end-of-line
# ignore filepaths used for corrections.
# See https://unix.stackexchange.com/a/422451/12497
export CORRECT_IGNORE_FILE='.*'
# bindkey "^[[A" history-beginning-search-backward
# bindkey "^[[B" history-beginning-search-forward
# use with alt+period which is enabled by default (it fetches the last arg of previous command and
# repeating hops back in history)
# this is supposed to cycle back through the cmd in history. It fails to cycle for me on macos
autoload -Uz copy-earlier-word
zle -N copy-earlier-word
bindkey "\e," copy-earlier-word
# black magic to implement helpful path completion
# https://stackoverflow.com/a/24237590/340947
zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
# https://apple.stackexchange.com/a/27272/13465
export PAGER=/opt/homebrew/bin/less
export LESS='-i -M -R -x4 -z-4'
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh