-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathzshrc
More file actions
146 lines (119 loc) · 3.24 KB
/
Copy pathzshrc
File metadata and controls
146 lines (119 loc) · 3.24 KB
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
141
142
143
144
145
146
#!/usr/bin/env zsh
#
# PARAMS
#
HISTFILE=~/.zhistory
HISTSIZE=10000
SAVEHIST=500
DIRSTACKSIZE=7
#
# OPTIONS
#
setopt AUTO_CD
setopt AUTO_PUSHD
setopt PUSHD_IGNORE_DUPS
setopt NO_BEEP
setopt EXTENDED_GLOB
setopt HIST_LEX_WORDS
setopt HIST_IGNORE_DUPS
setopt HIST_IGNORE_SPACE
setopt HIST_SAVE_NO_DUPS
setopt HIST_REDUCE_BLANKS
setopt INTERACTIVE_COMMENTS
setopt RM_STAR_SILENT
setopt LONG_LIST_JOBS
setopt OCTAL_ZEROES
setopt POSIX_ALIASES
setopt CSH_JUNKIE_HISTORY
setopt PROMPT_SUBST
setopt NO_LIST_AMBIGUOUS
setopt GLOB_COMPLETE
setopt COMPLETE_IN_WORD
setopt RC_EXPAND_PARAM
setopt RC_QUOTES
setopt TRANSIENT_RPROMPT
setopt COMPLETE_ALIASES
setopt NULL_GLOB
#
# BINDINGS
#
bindkey -e
bindkey '^t' push-line-or-edit
autoload edit-command-line
zle -N edit-command-line
bindkey '^x' edit-command-line
zmodload zsh/complist
bindkey -M listscroll q send-break
bindkey -M menuselect '^o' accept-and-menu-complete
#
# COMPLETIONS
#
autoload -U +X compinit && compinit
zstyle ':completion:*' verbose true
zstyle ':completion:*' list-separator '#'
zstyle ':completion:*' auto-description 'specify: %d'
zstyle ':completion:*' squeeze-slashes true
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
zstyle ':completion:*' insert-tab pending
zstyle ':completion:*' rehash true
zstyle ':completion:*:default' list-prompt '%SAt %p: Hit <TAB> for more, or the character to insert, or <q> to exit%s'
zstyle ':completion:*:default' menu 'select=0'
zstyle ':completion:*:history-words' list false
zstyle ':completion:*:windows' menu 'on=0'
zstyle ':completion::*:::' completer _expand _complete _prefix
zstyle ':completion:*:prefix:*' add-space true
zstyle ':completion:*' group-name ''
zstyle ':completion:*:descriptions' format '%B%d%b'
zstyle ':completion:*:expand:*' tag-order 'all-expansions original'
zstyle ':completion:*:expand:*' substitute true
zstyle ':completion:*:expand:*' accept-exact continue
zstyle ':completion:*' ignore-parents parent pwd
zstyle ':completion:*:*files' ignored-patterns '*?.(o|swp|pyc|pyo)' '*?~'
zstyle ':completion:*:*:cd:*' ignored-patterns '(*/|)CVS'
zstyle ':completion::*:(-command-|export):*' fake-parameters LD_LIBRARY_PATH
# Load every completion after autocomplete loads.
for file in ~/.zcompletions/*; do
source "$file"
done
fpath=(~/.zfunctions $fpath)
for file in ~/.zfunctions/*; do
autoload +X "$file"
done
#
# TMUX CONFIGURATION
#
function start_tmux() {
tmux_default_exec=$(command -v tmux)
if [ -z "$TMUX_EXEC" ]; then
TMUX_EXEC=$tmux_default_exec
fi
if [ ! -x "$TMUX_EXEC" ] || [ -z "$TMUX_AUTOSTART" ]; then
return
fi
autoload -U add-zsh-hook
add-zsh-hook preexec update_env_with_tmux
function update_env_with_tmux() {
local tmux_sock=default
if [ -n "$TMUX_VSCODE_SOCK" ]; then
tmux_sock=vscode
fi
if [ -n "$TMUX" ]; then
eval $($TMUX_EXEC -L $tmux_sock show-environment -s)
fi
}
if [ -n "$TMUX" ]; then
return
fi
local tmux_sock=default
local tmux_sess=$($TMUX_EXEC -L $tmux_sock list-sessions -F '#{session_name}' | head -n1)
if [ -z "$tmux_sess" ]; then
tmux_sess=0
fi
if [ -n "$TMUX_VSCODE_SOCK" ]; then
tmux_sock=vscode
tmux_sess=$(basename `pwd` | tr -dc '[:alnum:]-')-$(pwd | shasum | cut -c1-5)
fi
exec $TMUX_EXEC -L $tmux_sock new-session -AD -s $tmux_sess
}
start_tmux
unfunction start_tmux