-
Notifications
You must be signed in to change notification settings - Fork 0
/
dot_zshrc
122 lines (97 loc) · 2.88 KB
/
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
export SHELL=zsh
test -e ~/.alias && . ~/.alias || true
test -e ~/.env && . ~/.env || true
# Turn off software flow control (Ctrl-S/Q)
if [[ -z $DISTROBOX_ENTER_PATH ]]; then
stty -ixon <$TTY >$TTY
fi
# This may have been temporarily set during startup if config is shared with bash
unsetopt no_nomatch
setopt autopushd
# Load completion awesomeness
fpath=(/usr/share/zsh/vendor-completions/_pass $fpath)
autoload -U compinit && compinit
# Support bash completion too
autoload -U bashcompinit && bashcompinit
source /etc/bash_completion &> /dev/null
# Allow completion mid-word
zstyle ':completion:*' completer _complete _list _match _prefix
# Disable hostname completion
zstyle ':completion:*' hosts off
# Make git completion fast at the expense of some lost functionality
__git_files () {
_wanted files expl 'local files' _files
}
# Editor editing of command line
autoload -U edit-command-line
zle -N edit-command-line
bindkey -M vicmd v edit-command-line
# Uber-move
autoload -U zmv
alias mmv='noglob zmv -W'
# Interactive move
imv() {
local src dst
for src; do
[[ -e $src ]] || { print -u2 "$src does not exist"; continue }
dst=$src
vared dst
[[ $src != $dst ]] && mkdir -p $dst:h && mv $src $dst
done
}
# Window title
case $TERM in
foot|*rxvt*|*xterm*)
precmd () {print -Pn "\e]0;%M: %~ [%n]\a"}
preexec () {print -Pn "\e]0;%M: $2 [%n]\a"}
;;
esac
# Command line editing
bindkey -v # Vi key bindings
# Bind in both Vi modes
function bindglobal ()
{
bindkey -v $@
bindkey -a $@
}
# # Keep some Emacsy bindings
bindglobal '^A' beginning-of-line
bindglobal '^E' end-of-line
bindglobal '^P' up-history
bindglobal '^N' down-history
bindglobal '\e.' end-of-buffer-or-history
bindglobal '^R' history-incremental-search-backward
bindglobal '^U' kill-whole-line
bindglobal '^T' push-line
bindglobal '^Xe' expand-word
bindglobal '\ep' history-search-backward
bindglobal '^H' end-of-history
bindglobal '^w' backward-kill-word
bindglobal '^[.' insert-last-word
bindkey -a ':' execute-named-cmd
bindkey -a '.' execute-last-named-cmd
bindkey -a '/' history-incremental-search-backward
bindkey -a '?' history-incremental-search-forward
autoload -U edit-command-line
zle -N edit-command-line
bindglobal '^f' edit-command-line
# Make word handling like Bash
autoload -U select-word-style
select-word-style bash
# History setup
setopt inc_append_history
#setopt hist_verify
setopt share_history # Share history real-time between shells
export HISTFILE="$HOME/.zshhistory"
export HISTSIZE=5000
export SAVEHIST=$HISTSIZE
# fzf bindings
if [[ ! -z $NIX_PROFILES ]]; then
eval "$(fzf --zsh)" # after 0.48
fi
eval "$(starship init zsh)"
eval "$(zoxide init zsh)"
# Syntax highlighting in the shell
# Must be loaded last.
source ~/.local/lib/zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
test -e ~/.site.sh && . ~/.site.sh || true