-
Notifications
You must be signed in to change notification settings - Fork 0
/
plugin.tmux
executable file
·34 lines (25 loc) · 757 Bytes
/
plugin.tmux
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
#!/usr/bin/env bash
cd "$(dirname "${BASH_SOURCE[0]}")" \
|| exit 1
source "./scripts/utils.sh"
declare -r CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
declare -a REQUIRED_COMMANDS=(
'vault'
'jq'
'fzf'
)
main() {
for cmd in "${REQUIRED_COMMANDS[@]}"; do
if ! is_cmd_exists "$cmd"; then
display_message "command '$cmd' not found"
return 1
fi
done
local -r opt_key="$(get_tmux_option "@vault-key" "u")"
local -r opt_new_key="$(get_tmux_option "@vault-new-key" "N")"
tmux bind-key "$opt_key" \
run "tmux split-window -l 10 \"$CURRENT_DIR/scripts/main.sh '#{pane_id}'\""
tmux bind-key "$opt_new_key" \
run "tmux split-window -l 10 \"$CURRENT_DIR/scripts/new.sh '#{pane_id}'\""
}
main "$@"