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-14 16:13:59 +01:00
parent a9add6cc70
commit cfb89a4a07

View file

@ -121,16 +121,16 @@ bind -T copy-mode-vi H send -X start-of-line
bind -T copy-mode-vi L send -X end-of-line
# copy to X11 clipboard
if -b 'command -v xsel > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | xsel -i -b"'
if -b '! command -v xsel > /dev/null 2>&1 && command -v xclip > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | xclip -i -selection clipboard >/dev/null 2>&1"'
if -b 'command -v xsel > /dev/null 2>&1' 'bind y run -b "\"$TMUX_EXECUTABLE\" save-buffer - | xsel -i -b"'
if -b '! command -v xsel > /dev/null 2>&1 && command -v xclip > /dev/null 2>&1' 'bind y run -b "\"$TMUX_EXECUTABLE\" save-buffer - | xclip -i -selection clipboard >/dev/null 2>&1"'
# copy to Wayland clipboard
if -b 'command -v wl-copy > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | wl-copy"'
if -b 'command -v wl-copy > /dev/null 2>&1' 'bind y run -b "\"$TMUX_EXECUTABLE\" save-buffer - | wl-copy"'
# copy to macOS clipboard
if -b 'command -v pbcopy > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | pbcopy"'
if -b 'command -v reattach-to-user-namespace > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | reattach-to-user-namespace pbcopy"'
if -b 'command -v pbcopy > /dev/null 2>&1' 'bind y run -b "\"$TMUX_EXECUTABLE\" save-buffer - | pbcopy"'
if -b 'command -v reattach-to-user-namespace > /dev/null 2>&1' 'bind y run -b "\"$TMUX_EXECUTABLE\" save-buffer - | reattach-to-user-namespace pbcopy"'
# copy to Windows clipboard
if -b 'command -v clip.exe > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | clip.exe"'
if -b '[ -c /dev/clipboard ]' 'bind y run -b "tmux save-buffer - > /dev/clipboard"'
if -b 'command -v clip.exe > /dev/null 2>&1' 'bind y run -b "\"$TMUX_EXECUTABLE\" save-buffer - | clip.exe"'
if -b '[ -c /dev/clipboard ]' 'bind y run -b "\"$TMUX_EXECUTABLE\" save-buffer - > /dev/clipboard"'
# -- buffers -------------------------------------------------------------------
@ -187,7 +187,7 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
# fi
#
# tmux() {
# "$TMUX_EXECUTABLE" ${TMUX_SOCKER:+-S "$TMUX_SOCKET"} "$@"
# "$TMUX_EXECUTABLE" ${TMUX_SOCKET:+-S "$TMUX_SOCKET"} "$@"
# }
#
# _tmux_version=$(tmux -V | awk '{gsub(/[^0-9.]/, "", $2); print ($2+0) * 100}')
@ -257,12 +257,12 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
# if [ -z "$restore" ]; then
# [ "$(tmux list-panes -t "$current_session:" | wc -l | sed 's/^ *//g')" -eq 1 ] && tmux display "Can't maximize with only one pane" && return
# current_pane_height=$(tmux display -t "$current_pane" -p "#{pane_height}")
# info=$(tmux new-window -t "$current_session:" -F "#{session_name}:#{window_index}.#{pane_id}" -P "maximized... 2>/dev/null & tmux setw -t \"$current_session:\" remain-on-exit on; printf \"\\033[\$(tput lines);0fPane has been maximized, press <prefix>+ to restore\n\" '$current_pane'")
# info=$(tmux new-window -t "$current_session:" -F "#{session_name}:#{window_index}.#{pane_id}" -P "maximized... 2>/dev/null & \"$TMUX_EXECUTABLE\" ${TMUX_SOCKET:+-S \"$TMUX_SOCKET\"} setw -t \"$current_session:\" remain-on-exit on; printf \"\\034[\$(tput lines);0fPane has been maximized, press <prefix>+ to restore\n\" '$current_pane'")
# session_window=${info%.*}
# new_pane=${info#*.}
#
# retry=1000
# while [ x"$(tmux list-panes -t "$session_window" -F '#{session_name}:#{window_index}.#{pane_id} #{pane_dead}' 2>/dev/null)" != x"$info 1" ] && [ "$retry" -ne 0 ]; do
# retry=20
# while [ x"$("$TMUX_EXECUTABLE" -S "$TMUX_SOCKET" list-panes -t "$session_window" -F '#{session_name}:#{window_index}.#{pane_id} #{pane_dead}' 2>/dev/null)" != x"$info 1" ] && [ "$retry" -ne 0 ]; do
# sleep 0.1
# retry=$((retry - 1))
# done