christoomey / vim-tmux-navigator

Seamless navigation between tmux panes and vim splits
MIT License
5.07k stars 319 forks source link

Add g:tmux_navigator_preserve_zoom option #307

Closed b0o closed 2 years ago

b0o commented 2 years ago

Tmux offers a -Z option on the select-pane command that preserves the zoom state when navigating between panes. This PR adds an option to enable this behavior in vim-tmux-navigator.

Rationale: I often like to run tmux with two stacked panes, Vim on top and a shell below. I often keep Vim zoomed and want to briefly pop into the shell before going back to Vim, all while staying zoomed.

From tmux(1):

select-pane [-DdeLlMmRUZ] [-T title] [-t target-pane]
    [...snip...] 
        -Z keeps the window zoomed if it was zoomed. 

Note that when g:tmux_navigator_preserve_zoom is enabled, the -Z flag is always passed to select-pane, regardless of zoom state. This is safe because it has no effect while not zoomed.

christoomey commented 2 years ago

Thanks for the update @b0o!