-
Notifications
You must be signed in to change notification settings - Fork 0
/
private_dot_zshrc.tmpl
70 lines (59 loc) · 1.95 KB
/
private_dot_zshrc.tmpl
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
[[ -v ZPROF ]] && zmodload zsh/zprof # profile start
TMUX_AUTO_START="on"
# tmux autostart
if [[ "$TERM_PROGRAM" == "WezTerm" && -z "$TMUX" && "$TMUX_AUTO_START" == "on" ]]; then
tmux_running=$(pgrep tmux)
if [[ -z "$tmux_running" ]]; then
tmux new
else
attach_session=$(tmux 2>/dev/null ls -F \
'#{session_attached} #{?#{==:#{session_last_attached},},1,#{session_last_attached}} #{session_id}' |
awk '/^0/ { if ($2 > t) { t = $2; s = $3 } }; END { if (s) printf "%s", s }')
# アタッチされていないセッションがすでにあった場合は一番若い番号のセッションにアタッチ
if [ -n "$attach_session" ]; then
tmux attach -t "$attach_session"
else
if [[ "$PWD" =~ ^/mnt/c/Users/.* ]]; then
# wezterm&tmux経由だとカレントディレクトリがおかしくなるので対策
cd $HOME
fi
# アタッチされていないセッションがなかったので、セッションを立ち上げる
tmux new
fi
fi
fi
# Set the list of directories that Zsh searches for programs.
fpath=(
$HOME/.asdf/completions
$HOME/.local/lib/python3.8/site-packages/argcomplete/bash_completion.d
$HOME/.local/share/zsh/cmd_completions
$fpath
$HOME/.local/share/zsh/generated_man_completions
)
# Import all zsh settings
ZSHHOME="${HOME}/.zshrc.d"
[[ -f $HOME/.asdf/asdf.sh ]] && source "$HOME/.asdf/asdf.sh"
autoload bashcompinit && bashcompinit # for AWS
source $ZSHHOME/path.zsh
source $ZSHHOME/zim.zsh
source $ZSHHOME/environment.zsh
source $ZSHHOME/alias.zsh
source $ZSHHOME/function.zsh
{{- if .isLinux }}
source $ZSHHOME/linux.zsh
{{- end }}
{{- if .isMac }}
source $ZSHHOME/mac.zsh
{{- end }}
{{- if .isWSL }}
source $ZSHHOME/wsl.zsh
{{- end }}
source $ZSHHOME/theme.zsh
source $ZSHHOME/zle.zsh
if [[ "$TERM_PROGRAM" == "WezTerm" ]]; then
source $ZSHHOME/wezterm.sh
fi
complete -C '/usr/local/bin/aws_completer' aws # AWS completion
# key
[[ -f $HOME/.env ]] && source $HOME/.env
[[ -v ZPROF ]] && zprof # profile end