updated tpm integration
- automatically delete tpm when not used - automatically delete unused plugins - install plugins when subsequently enabling then in ~/.tmux.conf.local - use <prefix> + u to update plugins as <prefix> + U is bound to Urlview, fixes #507
This commit is contained in:
parent
4f332e6b17
commit
a97e3021cc
33
.tmux.conf
33
.tmux.conf
|
@ -1339,9 +1339,16 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
|
||||||
# window_active="$1"
|
# window_active="$1"
|
||||||
# tmux_conf_update_plugins_on_launch="$2"
|
# tmux_conf_update_plugins_on_launch="$2"
|
||||||
# tmux_conf_update_plugins_on_reload="$3"
|
# tmux_conf_update_plugins_on_reload="$3"
|
||||||
|
# tmux_conf_uninstall_plugins_on_reload="$4"
|
||||||
#
|
#
|
||||||
# TMUX_PLUGIN_MANAGER_PATH=${TMUX_PLUGIN_MANAGER_PATH:-~/.tmux/plugins}
|
# TMUX_PLUGIN_MANAGER_PATH=${TMUX_PLUGIN_MANAGER_PATH:-~/.tmux/plugins}
|
||||||
#
|
# if [ -z "$(tmux show -gv '@plugin')" ] && [ -z "$(tmux show -gv '@tpm_plugins')" ]; then
|
||||||
|
# if _is_enabled "$tmux_conf_uninstall_plugins_on_reload" && [ -d "$TMUX_PLUGIN_MANAGER_PATH/tpm" ]; then
|
||||||
|
# tmux display 'Uninstalling tpm and plugins...'
|
||||||
|
# rm -rf "$TMUX_PLUGIN_MANAGER_PATH"
|
||||||
|
# tmux display 'Done uninstalling tpm and plugins...'
|
||||||
|
# fi
|
||||||
|
# else
|
||||||
# if curl -Ikfs -o /dev/null --connect-timeout 2 --max-time 2 https://github.com; then
|
# if curl -Ikfs -o /dev/null --connect-timeout 2 --max-time 2 https://github.com; then
|
||||||
# if [ ! -d "$TMUX_PLUGIN_MANAGER_PATH/tpm" ]; then
|
# if [ ! -d "$TMUX_PLUGIN_MANAGER_PATH/tpm" ]; then
|
||||||
# install_tpm=true
|
# install_tpm=true
|
||||||
|
@ -1353,13 +1360,16 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
|
||||||
# (cd "$TMUX_PLUGIN_MANAGER_PATH/tpm" && git checkout -q master && git reset -q --hard HEAD && git pull -q origin master)
|
# (cd "$TMUX_PLUGIN_MANAGER_PATH/tpm" && git checkout -q master && git reset -q --hard HEAD && git pull -q origin master)
|
||||||
# fi
|
# fi
|
||||||
# if [ x"$install_tpm" = x"true" ] || [ x"$update_tpm" = x"true" ]; then
|
# if [ x"$install_tpm" = x"true" ] || [ x"$update_tpm" = x"true" ]; then
|
||||||
# perl -0777 -p -i -e 's/git clone --recursive/git clone --recursive --depth 1 --shallow-submodules/g
|
# perl -0777 -p -i -e 's/git clone/git clone --depth 1 --shallow-submodules/g
|
||||||
# ;s/(install_plugin "\$plugin")\n(\s+)done/\1&\n\2done\n\2wait/g' "$TMUX_PLUGIN_MANAGER_PATH/tpm/scripts/install_plugins.sh"
|
# ;s/(install_plugin "\$plugin")\n(\s+)done/\1&\n\2done\n\2wait/g' "$TMUX_PLUGIN_MANAGER_PATH/tpm/scripts/install_plugins.sh"&
|
||||||
# perl -p -i -e 's/git submodule update --init --recursive/git submodule update --init --recursive --depth 1/g' "$TMUX_PLUGIN_MANAGER_PATH/tpm/scripts/update_plugin.sh"
|
# perl -p -i -e 's/git submodule update --init --recursive/git submodule update --init --recursive --depth 1/g' "$TMUX_PLUGIN_MANAGER_PATH/tpm/scripts/update_plugin.sh"&
|
||||||
|
# wait
|
||||||
# tmux set-environment -g TMUX_PLUGIN_MANAGER_PATH "$TMUX_PLUGIN_MANAGER_PATH"
|
# tmux set-environment -g TMUX_PLUGIN_MANAGER_PATH "$TMUX_PLUGIN_MANAGER_PATH"
|
||||||
# fi
|
# fi
|
||||||
# if [ x"$update_tpm" = x"true" ]; then
|
# if [ x"$update_tpm" = x"true" ]; then
|
||||||
|
# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins" >/dev/null 2>&1
|
||||||
# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/update_plugins" all >/dev/null 2>&1
|
# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/update_plugins" all >/dev/null 2>&1
|
||||||
|
# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/clean_plugins" all >/dev/null 2>&1
|
||||||
# tmux display 'Done updating tpm and plugins...'
|
# tmux display 'Done updating tpm and plugins...'
|
||||||
# elif [ x"$install_tpm" = x"true" ]; then
|
# elif [ x"$install_tpm" = x"true" ]; then
|
||||||
# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins" >/dev/null 2>&1
|
# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins" >/dev/null 2>&1
|
||||||
|
@ -1369,7 +1379,13 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
|
||||||
# tmux display "GitHub doesn't seem to be reachable, skipping installing and/or updating tpm and plugins..."
|
# tmux display "GitHub doesn't seem to be reachable, skipping installing and/or updating tpm and plugins..."
|
||||||
# fi
|
# fi
|
||||||
#
|
#
|
||||||
|
# [ -z "$(tmux show -gv '@tpm-install')" ] && tmux set -g '@tpm-install' 'I'
|
||||||
|
# [ -z "$(tmux show -gv '@tpm-update')" ] && tmux set -g '@tpm-update' 'u'
|
||||||
|
# [ -z "$(tmux show -gv '@tpm-clean')" ] && tmux set -g '@tpm-clean' 'M-u'
|
||||||
# [ -f "$TMUX_PLUGIN_MANAGER_PATH/tpm/tpm" ] && "$TMUX_PLUGIN_MANAGER_PATH/tpm/tpm"
|
# [ -f "$TMUX_PLUGIN_MANAGER_PATH/tpm/tpm" ] && "$TMUX_PLUGIN_MANAGER_PATH/tpm/tpm"
|
||||||
|
# tmux set -gu '@tpm-install' \; set -gu '@tpm-update' \; set -gu '@tpm-clean' \; set -gu '@plugin'
|
||||||
|
# fi
|
||||||
|
#
|
||||||
# if [ -z "$window_active" ] && [ $_tmux_version -lt 240 ]; then
|
# if [ -z "$window_active" ] && [ $_tmux_version -lt 240 ]; then
|
||||||
# tmux run -b "sleep $(expr $(tmux display -p '#{display-time}') / 500) && tmux set display-time 3000 \; display 'This configuration will soon require tmux 2.4+' \; set -u display-time"
|
# tmux run -b "sleep $(expr $(tmux display -p '#{display-time}') / 500) && tmux set display-time 3000 \; display 'This configuration will soon require tmux 2.4+' \; set -u display-time"
|
||||||
# fi
|
# fi
|
||||||
|
@ -1378,13 +1394,8 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
|
||||||
# _apply_plugins() {
|
# _apply_plugins() {
|
||||||
# tmux_conf_update_plugins_on_launch=${tmux_conf_update_plugins_on_launch:-true}
|
# tmux_conf_update_plugins_on_launch=${tmux_conf_update_plugins_on_launch:-true}
|
||||||
# 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}
|
||||||
# if [ -n "$(tmux show -gv '@plugin')" ] || [ -n "$(tmux show -gv '@tpm_plugins')" ]; then
|
# tmux_conf_uninstall_plugins_on_reload=${tmux_conf_uninstall_plugins_on_reload:-true}
|
||||||
# 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 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\""
|
||||||
# elif [ -z "$window_active" ]; then
|
|
||||||
# if [ $_tmux_version -lt 240 ]; then
|
|
||||||
# tmux run -b 'tmux set display-time 3000 \; display "This configuration will soon require tmux 2.4+" \; set -u display-time'
|
|
||||||
# fi
|
|
||||||
# fi
|
|
||||||
# }
|
# }
|
||||||
#
|
#
|
||||||
# _apply_configuration() {
|
# _apply_configuration() {
|
||||||
|
|
|
@ -367,6 +367,17 @@ tmux_conf_update_plugins_on_launch=true
|
||||||
# - false
|
# - false
|
||||||
tmux_conf_update_plugins_on_reload=true
|
tmux_conf_update_plugins_on_reload=true
|
||||||
|
|
||||||
|
# by default, reloading the configuration will uninstall tpm and plugins when no
|
||||||
|
# plugins are enabled
|
||||||
|
# - true (default)
|
||||||
|
# - false
|
||||||
|
tmux_conf_uninstall_plugins_on_reload=true
|
||||||
|
|
||||||
|
# /!\ the tpm bindings differ slightly from upstream:
|
||||||
|
# - installing plugins: <prefix> + I
|
||||||
|
# - uninstalling plugins: <prefix> + Alt + u
|
||||||
|
# - updating plugins: <prefix> + u
|
||||||
|
|
||||||
# /!\ do not add set -g @plugin 'tmux-plugins/tpm'
|
# /!\ do not add set -g @plugin 'tmux-plugins/tpm'
|
||||||
# /!\ do not add run '~/.tmux/plugins/tpm/tpm'
|
# /!\ do not add run '~/.tmux/plugins/tpm/tpm'
|
||||||
|
|
||||||
|
|
|
@ -311,6 +311,11 @@ This configuration now comes with built-in [TPM] support:
|
||||||
- `~/.tmux.conf.local` copy ← people who are used to alter
|
- `~/.tmux.conf.local` copy ← people who are used to alter
|
||||||
`.tmux.conf` to add TPM support will have to adapt their configuration
|
`.tmux.conf` to add TPM support will have to adapt their configuration
|
||||||
|
|
||||||
|
⚠️ The TPM bindings differ slightly from upstream:
|
||||||
|
- installing plugins: `<prefix> + I`
|
||||||
|
- uninstalling plugins: `<prefix> + Alt + u`
|
||||||
|
- updating plugins: `<prefix> + u`
|
||||||
|
|
||||||
See `~/.tmux.conf.local` for instructions.
|
See `~/.tmux.conf.local` for instructions.
|
||||||
|
|
||||||
[TPM]: https://github.com/tmux-plugins/tpm
|
[TPM]: https://github.com/tmux-plugins/tpm
|
||||||
|
|
Loading…
Reference in New Issue