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:
parent
f44ff0a534
commit
a9add6cc70
1 changed files with 7 additions and 7 deletions
14
.tmux.conf
14
.tmux.conf
|
@ -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_EXECUTABLE" source "$TMUX_CONF" \; display "$TMUX_CONF_LOCAL sourced"'
|
||||
|
||||
# reload configuration
|
||||
bind r run 'tmux source "$TMUX_CONF"' \; display "#{TMUX_CONF} sourced"
|
||||
bind r run '"$TMUX_EXECUTABLE" source "$TMUX_CONF"' \; display "#{TMUX_CONF} sourced"
|
||||
|
||||
|
||||
# -- display -------------------------------------------------------------------
|
||||
|
@ -143,16 +143,16 @@ bind P choose-buffer # choose which buffer to paste from
|
|||
# -- 8< ------------------------------------------------------------------------
|
||||
|
||||
%if #{==:#{TMUX_EXECUTABLE},}
|
||||
run 'tmux set-environment -g TMUX_EXECUTABLE $(lsof -b -w -a -d txt -p #{pid} -Fn 2>/dev/null | perl -n -e "if (s/^n((?:.(?!dylib$|so$))+)$/\1/g) { print; exit } } exit 1; {" || readlink "/proc/#{pid}/exe" 2>/dev/null || printf tmux)'
|
||||
run 'TMUX_EXECUTABLE="$(lsof -b -w -a -d txt -p #{pid} -Fn 2>/dev/null | perl -n -e "if (s/^n((?:.(?!dylib$|so$))+)$/\1/g) { print; exit } } exit 1; {" || readlink "/proc/#{pid}/exe" 2>/dev/null || printf tmux)"; $TMUX_EXECUTABLE -S #{socket_path} set-environment -g TMUX_EXECUTABLE "$TMUX_EXECUTABLE"'
|
||||
%endif
|
||||
%if #{==:#{TMUX_CONF},}
|
||||
run 'tmux set-environment -g TMUX_CONF $(for conf in "$HOME/.tmux.conf" "$XDG_CONFIG_HOME/tmux/tmux.conf" "$HOME/.config/tmux/tmux.conf"; do [ -f "$conf" ] && printf "%s" "$conf" && break; done)'
|
||||
run '"$TMUX_EXECUTABLE" set-environment -g TMUX_CONF $(for conf in "$HOME/.tmux.conf" "$XDG_CONFIG_HOME/tmux/tmux.conf" "$HOME/.config/tmux/tmux.conf"; do [ -f "$conf" ] && printf "%s" "$conf" && break; done)'
|
||||
%endif
|
||||
%if #{==:#{TMUX_CONF_LOCAL},}
|
||||
run 'tmux set-environment -g TMUX_CONF_LOCAL "$TMUX_CONF.local"'
|
||||
run '"$TMUX_EXECUTABLE" set-environment -g TMUX_CONF_LOCAL "$TMUX_CONF.local"'
|
||||
%endif
|
||||
|
||||
run 'tmux source "$TMUX_CONF_LOCAL"'
|
||||
run '"$TMUX_EXECUTABLE" source "$TMUX_CONF_LOCAL"'
|
||||
run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
|
||||
|
||||
# EOF
|
||||
|
@ -743,7 +743,7 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
|
|||
# _apply_bindings() {
|
||||
# cfg=$(mktemp) && trap 'rm -f $cfg*' EXIT
|
||||
#
|
||||
# tmux list-keys | grep -vF 'tmux.conf.local' | grep -E 'new-window|split(-|_)window|new-session|copy-selection|copy-pipe' > "$cfg"
|
||||
# tmux list-keys | grep -vF 'TMUX_CONF_LOCAL' | grep -E 'new-window|split(-|_)window|new-session|copy-selection|copy-pipe' > "$cfg"
|
||||
#
|
||||
# # tmux 3.0 doesn't include 02254d1e5c881be95fd2fc37b4c4209640b6b266 and the
|
||||
# # output of list-keys can be truncated
|
||||
|
|
Loading…
Reference in a new issue