1
0
Fork 0
mirror of synced 2024-12-22 14:51:05 -05:00

added support for defining TPM plugins with 'set -g @tpm_plugins', resolves #706

This commit is contained in:
Gregory Pakosz 2024-01-12 13:50:41 +01:00
parent dd9502a09a
commit 1469d465f8
2 changed files with 19 additions and 16 deletions

View file

@ -1469,10 +1469,11 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
# } # }
# #
# __apply_plugins() { # __apply_plugins() {
# window_active="$1" # TMUX_PLUGIN_MANAGER_PATH="$1"
# tmux_conf_update_plugins_on_launch="$2" # window_active="$2"
# tmux_conf_update_plugins_on_reload="$3" # tmux_conf_update_plugins_on_launch="$3"
# tmux_conf_uninstall_plugins_on_reload="$4" # tmux_conf_update_plugins_on_reload="$4"
# tmux_conf_uninstall_plugins_on_reload="$5"
# #
# if [ -z "$TMUX_PLUGIN_MANAGER_PATH" ]; then # if [ -z "$TMUX_PLUGIN_MANAGER_PATH" ]; then
# return 255 # return 255
@ -1483,15 +1484,18 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
# if [ -z "$(tmux show -gv '@plugin' 2>/dev/null)" ] && [ -z "$tpm_plugins" ]; then # if [ -z "$(tmux show -gv '@plugin' 2>/dev/null)" ] && [ -z "$tpm_plugins" ]; then
# if _is_true "$tmux_conf_uninstall_plugins_on_reload" && [ -d "$TMUX_PLUGIN_MANAGER_PATH/tpm" ]; then # if _is_true "$tmux_conf_uninstall_plugins_on_reload" && [ -d "$TMUX_PLUGIN_MANAGER_PATH/tpm" ]; then
# tmux display 'Uninstalling tpm and plugins...' # tmux display 'Uninstalling tpm and plugins...'
# tmux set-environment -gu TMUX_PLUGIN_MANAGER_PATH
# rm -rf "$TMUX_PLUGIN_MANAGER_PATH" # rm -rf "$TMUX_PLUGIN_MANAGER_PATH"
# tmux display 'Done uninstalling tpm and plugins...' # tmux display 'Done uninstalling tpm and plugins...'
# fi # fi
# else # else
# if [ "$(command tmux display -p '#{pid} #{version} #{socket_path}')" = "$($TMUX_PROGRAM display -p '#{pid} #{version} #{socket_path}')" ]; then # if [ "$(command tmux display -p '#{pid} #{version} #{socket_path}')" = "$($TMUX_PROGRAM display -p '#{pid} #{version} #{socket_path}')" ]; then
# tpm_plugins=$(cat << EOF | tr ' ' '\n' | awk '/^\s*$/ {next;}; !seen[$0]++ { gsub(/^[ \t]+/,"",$0); gsub(/[ \t]+$/,"",$0); print $0 }' # tpm_plugins=$(cat << EOF | tr ' ' '\n' | awk '/^\s*$/ {next;}; !seen[$0]++ { gsub(/^[ \t]+/,"",$0); gsub(/[ \t]+$/,"",$0); print $0 }'
# "$tpm_plugins"
# $(awk '/^[ \t]*set(-option)?.*[ \t]@plugin[ \t]/ { gsub(/'\''/, ""); gsub(/'\"'/, ""); print $NF }' "$TMUX_CONF_LOCAL" 2>/dev/null) # $(awk '/^[ \t]*set(-option)?.*[ \t]@plugin[ \t]/ { gsub(/'\''/, ""); gsub(/'\"'/, ""); print $NF }' "$TMUX_CONF_LOCAL" 2>/dev/null)
# EOF # EOF
# ) # )
# tmux set-environment -g TMUX_PLUGIN_MANAGER_PATH "$TMUX_PLUGIN_MANAGER_PATH"
# tmux set -g '@tpm_plugins' "$tpm_plugins" # tmux set -g '@tpm_plugins' "$tpm_plugins"
# if git ls-remote -hq https://github.com/gpakosz/.tmux.git master > /dev/null; then # if git ls-remote -hq https://github.com/gpakosz/.tmux.git master > /dev/null; then
# if [ ! -d "$TMUX_PLUGIN_MANAGER_PATH/tpm" ]; then # if [ ! -d "$TMUX_PLUGIN_MANAGER_PATH/tpm" ]; then
@ -1539,9 +1543,9 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
# fi # fi
# #
# if [ "$_tmux_version" -gt 260 ]; then # if [ "$_tmux_version" -gt 260 ]; then
# tmux set -gu '@tpm-install' \; set -gu '@tpm-update' \; set -gu '@tpm-clean' \; set -gu '@plugin' # tmux set -gu '@tpm-install' \; set -gu '@tpm-update' \; set -gu '@tpm-clean' \; set -gu '@plugin' \; set -gu '@tpm_plugins'
# else # else
# tmux set -g '@tpm-install' '' \; set -g '@tpm-update' '' \; set -g '@tpm-clean' '' \; set -g '@plugin' '' # tmux set -g '@tpm-install' '' \; set -g '@tpm-update' '' \; set -g '@tpm-clean' '' \; set -g '@plugin' '' \; set-gu '@tpm_plugins' ''
# fi # fi
# fi # fi
# } # }
@ -1551,18 +1555,14 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
# tmux_conf_update_plugins_on_reload=${tmux_conf_update_plugins_on_reload:-true} # tmux_conf_update_plugins_on_reload=${tmux_conf_update_plugins_on_reload:-true}
# tmux_conf_uninstall_plugins_on_reload=${tmux_conf_uninstall_plugins_on_reload:-true} # tmux_conf_uninstall_plugins_on_reload=${tmux_conf_uninstall_plugins_on_reload:-true}
# #
# tpm_plugins=$(tmux show -gvq '@tpm_plugins' 2>/dev/null) # if [ -z "$TMUX_PLUGIN_MANAGER_PATH" ]; then
# if [ -n "$(tmux show -gv '@plugin' 2>/dev/null)" ] || [ -n "$tpm_plugins" ]; then # if [ "$(dirname "$TMUX_CONF")" = "$HOME" ]; then
# if [ -z "$TMUX_PLUGIN_MANAGER_PATH" ]; then # TMUX_PLUGIN_MANAGER_PATH="$HOME/.tmux/plugins"
# if [ "$(dirname "$TMUX_CONF")" = "$HOME" ]; then # else
# TMUX_PLUGIN_MANAGER_PATH="$HOME/.tmux/plugins" # TMUX_PLUGIN_MANAGER_PATH="$(dirname "$TMUX_CONF")/plugins"
# else
# TMUX_PLUGIN_MANAGER_PATH="$(dirname "$TMUX_CONF")/plugins"
# fi
# tmux set-environment -g TMUX_PLUGIN_MANAGER_PATH "$TMUX_PLUGIN_MANAGER_PATH"
# fi # fi
# tmux run -b "cut -c3- '$TMUX_CONF' | sh -s __apply_plugins '$window_active' '$tmux_conf_update_plugins_on_launch' '$tmux_conf_update_plugins_on_reload' '$tmux_conf_uninstall_plugins_on_reload'"
# fi # fi
# tmux run -b "cut -c3- '$TMUX_CONF' | sh -s __apply_plugins '$TMUX_PLUGIN_MANAGER_PATH' '$window_active' '$tmux_conf_update_plugins_on_launch' '$tmux_conf_update_plugins_on_reload' '$tmux_conf_uninstall_plugins_on_reload'"
# } # }
# #
# _apply_important() { # _apply_important() {

View file

@ -429,6 +429,8 @@ tmux_conf_uninstall_plugins_on_reload=true
# then, use #{foo} in e.g. the 'tmux_conf_theme_status_left' or the # then, use #{foo} in e.g. the 'tmux_conf_theme_status_left' or the
# 'tmux_conf_theme_status_right' variables. # 'tmux_conf_theme_status_right' variables.
# ------------------------------------------------------------------------------
# # /!\ do not remove the following line # # /!\ do not remove the following line
# EOF # EOF
# #
@ -445,3 +447,4 @@ tmux_conf_uninstall_plugins_on_reload=true
# #
# "$@" # "$@"
# # /!\ do not remove the previous line # # /!\ do not remove the previous line
# # do not write below this line