1
0
Fork 0
mirror of synced 2024-11-13 21:18:57 -05:00
This commit is contained in:
verschmelzen 2023-03-04 19:04:50 -08:00 committed by GitHub
commit edb9e39b21
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 21 additions and 7 deletions

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
# Tmux key-binding script.
# Tmux command script.
# Scripts intended to be used via the command line are in `bin/` directory.
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
# Tmux key-binding script.
# Tmux command script.
# Scripts intended to be used via the command line are in `bin/` directory.
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
# Tmux key-binding script.
# Tmux command script.
# Scripts intended to be used via the command line are in `bin/` directory.
# This script:

View file

@ -7,6 +7,10 @@ default_update_key="U"
clean_key_option="@tpm-clean"
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"
DEFAULT_TPM_ENV_VAR_NAME="TMUX_PLUGIN_MANAGER_PATH"

18
tpm
View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
BINDINGS_DIR="$CURRENT_DIR/bindings"
COMMANDS_DIR="$CURRENT_DIR/commands"
SCRIPTS_DIR="$CURRENT_DIR/scripts"
source "$SCRIPTS_DIR/variables.sh"
@ -53,18 +53,27 @@ source_plugins() {
"$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 $COMMANDS_DIR/tpm-install"
tmux set-option -ag command-alias "tpm-update=run-shell $COMMANDS_DIR/tpm-update"
tmux set-option -ag command-alias "tpm-clean=run-shell $COMMANDS_DIR/tpm-clean"
}
# prefix + I - downloads TPM plugins 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
set_tpm_key_bindings() {
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")"
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")"
tmux bind-key "$clean_key" run-shell "$BINDINGS_DIR/clean_plugins"
tmux bind-key "$clean_key" tpm-clean
}
supported_tmux_version_ok() {
@ -74,6 +83,7 @@ supported_tmux_version_ok() {
main() {
if supported_tmux_version_ok; then
set_tpm_path
set_tpm_commands
set_tpm_key_bindings
source_plugins
fi