-
Notifications
You must be signed in to change notification settings - Fork 2
/
zsh-cmd-architect.plugin.zsh
executable file
·56 lines (44 loc) · 1.2 KB
/
zsh-cmd-architect.plugin.zsh
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
#!/usr/bin/env zsh
#
# No plugin manager is needed to use this file. All that is needed is adding:
# source {where-znt-is}/zsh-cmd-architect.plugin.zsh
#
# to ~/.zshrc.
#
0="${(%):-%N}" # this gives immunity to functionargzero being unset
# https://wiki.zshell.dev/community/zsh_plugin_standard#standard-plugins-hash
typeset -gA Plugins
Plugins[ZCA_DIR]="${0:h}"
CONFIG_DIR="$HOME/.config/zca"
#
# Update FPATH if:
# 1. Not loading with Zi
# 2. Not having fpath already updated (that would equal: using other plugin manager)
#
# https://wiki.zshell.dev/community/zsh_plugin_standard#functions-directory
if [[ $PMSPEC != *f* ]]; then
fpath+=( "${0:h}/functions" )
fi
#
# Copy configs
#
if [[ ! -d "$HOME/.config" ]]; then
command mkdir "$HOME/.config"
fi
if [[ ! -d "$CONFIG_DIR" ]]; then
command mkdir "$CONFIG_DIR"
fi
unset __ZCA_CONFIG_FILE
typeset -g __ZCA_CONFIG_FILE
for __ZCA_CONFIG_FILE in "h-list.conf" "zca.conf"; do
if [[ ! -f "$CONFIG_DIR/$__ZCA_CONFIG_FILE" ]]; then
command cp "$Plugins[ZCA_DIR]/.config/zca/$__ZCA_CONFIG_FILE" "$CONFIG_DIR"
fi
done
unset __ZCA_CONFIG_FILE
#
# Load functions
#
autoload h-list zca zca-usetty-wrapper zca-widget
zle -N zca-widget
bindkey '^T' zca-widget