1
0
Fork 0
mirror of synced 2024-12-04 14:45:38 -05:00

fixup! added support for configuration files in the following locations: - ~/.tmux.conf and ~/.tmux.conf.local - $XDG_CONFIG_HOME/tmux/tmux.conf and $XDG_CONFIG_HOME/tmux/tmux.conf.local - ~/.config/tmux/tmux.conf and ~/.config/tmux/tmux.conf.local

This commit is contained in:
Gregory Pakosz 2023-01-12 00:06:03 +01:00
parent db08136783
commit ac814b6411

View file

@ -26,10 +26,10 @@ setw -q -g utf8 on
set -g history-limit 5000 # boost history
# edit configuration
bind e new-window -n "$TMUX_CONF_LOCAL" sh -c "\${EDITOR:-vim} \"$TMUX_CONF_LOCAL\" && tmux source \"$TMUX_CONF\" && tmux display \"$TMUX_CONF sourced\""
bind e new-window -n "#{TMUX_CONF_LOCAL}" sh -c '${EDITOR:-vim} "$TMUX_CONF_LOCAL" && tmux source "$TMUX_CONF" && tmux display "$TMUX_CONF sourced"'
# reload configuration
bind r source-file "$TMUX_CONF" \; display "$TMUX_CONF sourced"
bind r run 'tmux source "$TMUX_CONF"' \; display "#{TMUX_CONF} sourced"
# -- display -------------------------------------------------------------------
@ -80,7 +80,7 @@ bind > swap-pane -D # swap current pane with the next one
bind < swap-pane -U # swap current pane with the previous one
# maximize current pane
bind + run "cut -c3- \"$TMUX_CONF\" | sh -s _maximize_pane '#{session_name}' '#D'"
bind + run "cut -c3- \"#{TMUX_CONF}\" | sh -s _maximize_pane '#{session_name}' '#D'"
# pane resizing
bind -r H resize-pane -L 2
@ -96,17 +96,17 @@ bind -r C-l next-window # select next window
bind Tab last-window # move to last active window
# toggle mouse
bind m run "cut -c3- \"$TMUX_CONF\" | sh -s _toggle_mouse"
bind m run "cut -c3- \"#{TMUX_CONF}\" | sh -s _toggle_mouse"
# -- urlview -------------------------------------------------------------------
bind U run "cut -c3- \"$TMUX_CONF\" | sh -s _urlview '#{pane_id}'"
bind U run "cut -c3- \"#{TMUX_CONF}\" | sh -s _urlview '#{pane_id}'"
# -- facebook pathpicker -------------------------------------------------------
bind F run "cut -c3- \"$TMUX_CONF\" | sh -s _fpp '#{pane_id}' '#{pane_current_path}'"
bind F run "cut -c3- \"#{TMUX_CONF}\" | sh -s _fpp '#{pane_id}' '#{pane_current_path}'"
# -- copy mode -----------------------------------------------------------------
@ -151,9 +151,9 @@ bind P choose-buffer # choose which buffer to paste from
%if #{==:#{TMUX_CONF_LOCAL},}
run 'tmux set-environment -g TMUX_CONF_LOCAL "$TMUX_CONF.local"'
%endif
source -qF '#{TMUX_CONF_LOCAL}'
run 'cut -c3- "#{TMUX_CONF}" | sh -s _apply_configuration'
run 'tmux source "$TMUX_CONF_LOCAL"'
run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
# EOF
#
@ -1387,8 +1387,11 @@ run 'cut -c3- "#{TMUX_CONF}" | sh -s _apply_configuration'
# tmux_conf_update_plugins_on_reload="$3"
# tmux_conf_uninstall_plugins_on_reload="$4"
#
# TMUX_PLUGIN_MANAGER_PATH=${TMUX_PLUGIN_MANAGER_PATH:-~/.tmux/plugins}
# if [ -z "$(tmux show -gv '@plugin')" ] && [ -z "$(tmux show -gv '@tpm_plugins')" ]; then
# TMUX_PLUGIN_MANAGER_PATH=${TMUX_PLUGIN_MANAGER_PATH:-$(dirname "$TMUX_CONF")/plugins}
# mkdir -p "$TMUX_PLUGIN_MANAGER_PATH"
#
# tpm_plugins=$(tmux show -gvq '@tpm_plugins')
# if [ -z "$(tmux show -gv '@plugin')" ] && [ -z "$tpm_plugins" ]; then
# if _is_true "$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"
@ -1396,6 +1399,13 @@ run 'cut -c3- "#{TMUX_CONF}" | sh -s _apply_configuration'
# fi
# else
# if git ls-remote -hq https://github.com/gpakosz/.tmux.git master > /dev/null; then
# tpm_plugins=$(cat << EOF | tr ' ' '\n' | uniq
# $(printf '%s' "$tpm_plugins")
# $(awk '/^[ \t]*set(-option)?.*[ \t]@plugin[ \t]/ { gsub(/'\''/, ""); gsub(/'\"'/, ""); print $NF }' ~/.config/tmux/tmux.conf.local 2>/dev/null)
# EOF
# )
# tmux set -g '@tpm_plugins' "$tpm_plugins"
#
# if [ ! -d "$TMUX_PLUGIN_MANAGER_PATH/tpm" ]; then
# install_tpm=true
# tmux display 'Installing tpm and plugins...'
@ -1438,7 +1448,7 @@ run 'cut -c3- "#{TMUX_CONF}" | sh -s _apply_configuration'
# [ -z "$(tmux show -gqv '@tpm-clean')" ] && tmux set -g '@tpm-clean' 'M-u'
# [ -f "$TMUX_PLUGIN_MANAGER_PATH/tpm/tpm" ] && "$TMUX_PLUGIN_MANAGER_PATH/tpm/tpm" || tmux display "One or more tpm plugin(s) failed"
# 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'
# fi
# fi
# }