1
0
Fork 0
mirror of synced 2024-12-22 06:41:07 -05:00

fixed maximize pane not supporting session names with spaces

This commit is contained in:
Gregory Pakosz 2017-09-25 20:28:58 +02:00
parent 7cdc172e22
commit 2849c14e0c

View file

@ -76,7 +76,7 @@ bind > swap-pane -D # swap current pane with the next one
bind < swap-pane -U # swap current pane with the previous one bind < swap-pane -U # swap current pane with the previous one
# maximize current pane # 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 # pane resizing
bind -r H resize-pane -L 2 bind -r H resize-pane -L 2
@ -196,11 +196,11 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# current_pane=${2:-$(tmux display -p '#{pane_id}')} # current_pane=${2:-$(tmux display -p '#{pane_id}')}
# #
# dead_panes=$(tmux list-panes -s -t "$current_session" -F '#{pane_dead} #{pane_id} #{pane_start_command}' | grep -o '^1 %.\+maximized.\+$' || true) # dead_panes=$(tmux list-panes -s -t "$current_session" -F '#{pane_dead} #{pane_id} #{pane_start_command}' | grep -o '^1 %.\+maximized.\+$' || true)
# restore=$(echo "$dead_panes" | sed -n -E -e "s/^1 $current_pane .+maximized.+(%[0-9]+)$/tmux swap-pane -s \1 -t $current_pane \; kill-pane -t $current_pane/p" -e "s/^1 (%[0-9]+) .+maximized.+$current_pane$/tmux swap-pane -s \1 -t $current_pane \; kill-pane -t \1/p" ) # restore=$(echo "$dead_panes" | sed -n -E -e "s/^1 $current_pane .+maximized.+'(%[0-9]+)'$/tmux swap-pane -s \1 -t $current_pane \; kill-pane -t $current_pane/p" -e "s/^1 (%[0-9]+) .+maximized.+'$current_pane'$/tmux swap-pane -s \1 -t $current_pane \; kill-pane -t \1/p" )
# #
# if [ -z "$restore" ]; then # 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 # [ "$(tmux list-panes -t "$current_session:" | wc -l | sed 's/^ *//g')" -eq 1 ] && tmux display "Can't maximize with only one pane" && return
# window=$(tmux new-window -t "$current_session:" -P "exec maximized... 2> /dev/null & tmux setw -t $current_session: remain-on-exit on; printf 'Pane has been maximized, press <prefix>+ to restore. %s' \\$current_pane") # window=$(tmux new-window -t "$current_session:" -P "exec maximized... 3> /dev/null & tmux setw -t \"$current_session:\" remain-on-exit on; printf \"Pane has been maximized, press <prefix>+ to restore. %s\" '$current_pane'")
# window=${window%.*} # window=${window%.*}
# #
# guard=10 # guard=10
@ -212,7 +212,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# tmux display 'Unable to maximize pane' # tmux display 'Unable to maximize pane'
# fi # fi
# #
# new_pane=$(tmux display -p '#{pane_id}') # new_pane=$(tmux display -t "$window" -p '#{pane_id}')
# tmux setw -t "$window" remain-on-exit off \; swap-pane -s "$current_pane" -t "$new_pane" # tmux setw -t "$window" remain-on-exit off \; swap-pane -s "$current_pane" -t "$new_pane"
# else # else
# $restore || tmux kill-pane # $restore || tmux kill-pane