Add commands and use them for bindings
This commit is contained in:
parent
693e5a2a0f
commit
0e2fab8c8f
2 changed files with 17 additions and 3 deletions
|
@ -7,6 +7,10 @@ default_update_key="U"
|
||||||
clean_key_option="@tpm-clean"
|
clean_key_option="@tpm-clean"
|
||||||
default_clean_key="M-u"
|
default_clean_key="M-u"
|
||||||
|
|
||||||
|
# TODO
|
||||||
|
# Since command-alias was not previosly used in tpm we need to make sure
|
||||||
|
# that the version here reflects the requirements for the command-alias to
|
||||||
|
# be present the required version for command-alias to work
|
||||||
SUPPORTED_TMUX_VERSION="1.9"
|
SUPPORTED_TMUX_VERSION="1.9"
|
||||||
|
|
||||||
DEFAULT_TPM_ENV_VAR_NAME="TMUX_PLUGIN_MANAGER_PATH"
|
DEFAULT_TPM_ENV_VAR_NAME="TMUX_PLUGIN_MANAGER_PATH"
|
||||||
|
|
16
tpm
16
tpm
|
@ -53,18 +53,27 @@ source_plugins() {
|
||||||
"$SCRIPTS_DIR/source_plugins.sh" >/dev/null 2>&1
|
"$SCRIPTS_DIR/source_plugins.sh" >/dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# tpm-install - downloads TPM plugins and reloads TMUX environment
|
||||||
|
# tpm-update - updates a plugin (or all of them) and reloads TMUX environment
|
||||||
|
# tpm-clean - remove unused TPM plugins and reloads TMUX environment
|
||||||
|
set_tpm_commands() {
|
||||||
|
tmux set-option -ag command-alias "tpm-install=run-shell $BINDINGS_DIR/install_plugins"
|
||||||
|
tmux set-option -ag command-alias "tpm-update=run-shell $BINDINGS_DIR/update_plugins"
|
||||||
|
tmux set-option -ag command-alias "tpm-clean=run-shell $BINDINGS_DIR/clean_plugins"
|
||||||
|
}
|
||||||
|
|
||||||
# prefix + I - downloads TPM plugins and reloads TMUX environment
|
# prefix + I - downloads TPM plugins and reloads TMUX environment
|
||||||
# prefix + U - updates a plugin (or all of them) and reloads TMUX environment
|
# prefix + U - updates a plugin (or all of them) and reloads TMUX environment
|
||||||
# prefix + alt + u - remove unused TPM plugins and reloads TMUX environment
|
# prefix + alt + u - remove unused TPM plugins and reloads TMUX environment
|
||||||
set_tpm_key_bindings() {
|
set_tpm_key_bindings() {
|
||||||
local install_key="$(get_tmux_option "$install_key_option" "$default_install_key")"
|
local install_key="$(get_tmux_option "$install_key_option" "$default_install_key")"
|
||||||
tmux bind-key "$install_key" run-shell "$BINDINGS_DIR/install_plugins"
|
tmux bind-key "$install_key" tpm-install
|
||||||
|
|
||||||
local update_key="$(get_tmux_option "$update_key_option" "$default_update_key")"
|
local update_key="$(get_tmux_option "$update_key_option" "$default_update_key")"
|
||||||
tmux bind-key "$update_key" run-shell "$BINDINGS_DIR/update_plugins"
|
tmux bind-key "$update_key" tpm-update
|
||||||
|
|
||||||
local clean_key="$(get_tmux_option "$clean_key_option" "$default_clean_key")"
|
local clean_key="$(get_tmux_option "$clean_key_option" "$default_clean_key")"
|
||||||
tmux bind-key "$clean_key" run-shell "$BINDINGS_DIR/clean_plugins"
|
tmux bind-key "$clean_key" tpm-clean
|
||||||
}
|
}
|
||||||
|
|
||||||
supported_tmux_version_ok() {
|
supported_tmux_version_ok() {
|
||||||
|
@ -74,6 +83,7 @@ supported_tmux_version_ok() {
|
||||||
main() {
|
main() {
|
||||||
if supported_tmux_version_ok; then
|
if supported_tmux_version_ok; then
|
||||||
set_tpm_path
|
set_tpm_path
|
||||||
|
set_tpm_commands
|
||||||
set_tpm_key_bindings
|
set_tpm_key_bindings
|
||||||
source_plugins
|
source_plugins
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue