added support for tpm, resolves #61

This commit is contained in:
Gregory Pakosz
2021-01-09 21:04:48 +01:00
parent 2aaacfbd8f
commit d950ee3c8c
4 changed files with 118 additions and 16 deletions
+67 -13
View File
@@ -162,13 +162,12 @@ bind P choose-buffer # choose which buffer to paste from
# -- user defined overrides ----------------------------------------------------
if '[ -f ~/.tmux.conf.local ]' 'source ~/.tmux.conf.local'
source -q ~/.tmux.conf.local
# -- 8< ------------------------------------------------------------------------
run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-time 3000 \; display "This configuration will soon require tmux >= 2.4" \; set -u display-time || true'
# EOF
@@ -1332,19 +1331,72 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim
# setw -g clock-mode-style "$tmux_conf_theme_clock_style"
# }
#
# __apply_plugins() {
# window_active="$1"
# tmux_conf_update_plugins_on_launch="$2"
# tmux_conf_update_plugins_on_reload="$3"
#
# TMUX_PLUGIN_MANAGER_PATH=${TMUX_PLUGIN_MANAGER_PATH:-~/.tmux/plugins}
# if [ ! -d "$TMUX_PLUGIN_MANAGER_PATH/tpm" ]; then
# install_tpm=true
# tmux display 'Installing tpm and plugins...'
# git clone --depth 1 https://github.com/tmux-plugins/tpm "$TMUX_PLUGIN_MANAGER_PATH/tpm"
# elif { [ -z "$window_active" ] && _is_enabled "$tmux_conf_update_plugins_on_launch"; } || { [ -n "$window_active" ] && _is_enabled "$tmux_conf_update_plugins_on_reload"; }; then
# update_tpm=true
# tmux display 'Updating tpm and plugins...'
# (cd "$TMUX_PLUGIN_MANAGER_PATH/tpm" && git checkout -q master && git reset -q --hard HEAD && git pull -q origin master)
# fi
# 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
# ;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"
# tmux set-environment -g TMUX_PLUGIN_MANAGER_PATH "$TMUX_PLUGIN_MANAGER_PATH"
# fi
# if [ x"$update_tpm" = x"true" ]; then
# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/update_plugins" all >/dev/null 2>&1
# tmux display 'Done updating tpm and plugins...'
# elif [ x"$install_tpm" = x"true" ]; then
# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins" >/dev/null 2>&1
# tmux display 'Done installing tpm and plugins...'
# fi
# "$TMUX_PLUGIN_MANAGER_PATH/tpm/tpm"
# if [ -z "$window_active" ] && [ $_tmux_version -lt 204 ]; 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"
# fi
# }
#
# _apply_plugins() {
# 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}
# if [ -n "$(tmux show -gv '@plugin')" ] || [ -n "$(tmux show -gv '@tpm_plugins')" ]; then
# 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\""
# elif [ -z "$window_active" ]; then
# if [ $_tmux_version -lt 204 ]; 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() {
#
# if ! command -v perl > /dev/null 2>&1; then
# tmux run -b 'tmux set display-time 3000 \; display "This configuration requires perl" \; set -u display-time'
# return
# fi
# if ! command -v sed > /dev/null 2>&1; then
# tmux run -b 'tmux set display-time 3000 \; display "This configuration requires sed" \; set -u display-time'
# return
# fi
# if ! command -v awk > /dev/null 2>&1; then
# tmux run -b 'tmux set display-time 3000 \; display "This configuration requires awk" \; set -u display-time'
# return
# window_active="$(tmux display -p '#{window_active}' 2>/dev/null || true)"
# if [ -z "$window_active" ]; then
# if ! command -v perl > /dev/null 2>&1; then
# tmux run -b 'tmux set display-time 3000 \; display "This configuration requires perl" \; set -u display-time \; run "sleep 3" \; kill-server'
# return
# fi
# if ! command -v sed > /dev/null 2>&1; then
# tmux run -b 'tmux set display-time 3000 \; display "This configuration requires sed" \; set -u display-time \; run "sleep 3" \; kill-server'
# return
# fi
# if ! command -v awk > /dev/null 2>&1; then
# tmux run -b 'tmux set display-time 3000 \; display "This configuration requires awk" \; set -u display-time \; run "sleep 3" \; kill-server'
# return
# fi
# if [ $_tmux_version -lt 203 ]; then
# tmux run -b 'tmux set display-time 3000 \; display "This configuration requires tmux 2.3+" \; set -u display-time \; run "sleep 3" \; kill-server'
# return
# fi
# fi
#
# # see https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard
@@ -1374,6 +1426,8 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim
# # shellcheck disable=SC2046
# tmux setenv -gu tmux_conf_dummy $(printenv | grep -E -o '^tmux_conf_[^=]+' | awk '{printf "; setenv -gu %s", $0}')
# wait
#
# _apply_plugins
# }
#
# _urlview() {