christoomey / vim-tmux-navigator

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

Pressing j or k in nvim after resizing tmux pane undos the resize #332

Closed thijssmudde closed 1 year ago

thijssmudde commented 1 year ago

Issue description

After resizing the tmux pane fully (with Z option) I'm often going to a pane with neovim. In this pane I directly start navigating with j and k. However, this results in undoing the resizing of the pane. It seems to me like the resizing should only be undone with another resize command.

Required information

Please provide the following information:

Tmux conf ``` set -g default-terminal "screen-255color" set -g prefix C-a unbind C-b bind-key C-a send-prefix # Split horizontally and open new pane in same path unbind % bind | split-window -h -c "#{pane_current_path}" # Split vertically and open new pane in same path unbind '"' bind - split-window -v -c "#{pane_current_path}" # Open new pane in same path bind c new-window -c "#{pane_current_path}" unbind r bind r source-file ~/.tmux.conf bind -r j resize-pane -D 5 bind -r k resize-pane -U 5 bind -r l resize-pane -R 5 bind -r h resize-pane -L 5 bind -r m resize-pane -Z set -g mouse on setw -g mouse on set-window-option -g mode-keys vi set-option -sg escape-time 10 set-option -g focus-events on set-option -sa terminal-overrides ',XXX:RGB' bind-key -T copy-mode-vi 'v' send -X begin-selection # start selecting text with "v" bind-key -T copy-mode-vi 'y' send -X copy-selection # copy text with "y" unbind -T copy-mode-vi MouseDragEnd1Pane # don't exit copy mode after dragging with mouse # tpm plugin set -g @plugin 'tmux-plugins/tpm' # list of tmux plugins set -g @plugin 'christoomey/vim-tmux-navigator' # for navigating panes and vim/nvim with Ctrl-hjkl set -g @plugin 'jimeh/tmux-themepack' # to configure tmux theme set -g @plugin 'tmux-plugins/tmux-resurrect' # persist tmux sessions after computer restart set -g @plugin 'tmux-plugins/tmux-continuum' # automatically saves sessions for you every 15 minutes set -g @themepack 'powerline/default/cyan' # use this theme for tmux set -g @resurrect-capture-pane-contents 'on' # allow tmux-ressurect to capture pane contents set -g @continuum-restore 'on' # enable tmux-continuum functionality # Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) run '~/.tmux/plugins/tpm/tpm' ```
christoomey commented 1 year ago

I believe the behavior you’re describing is standard tmux behavior and not something that this plugin can change.

To be more specific, if you zoom a tmux pane and then use the navigation keys (C-hjkl) then tmux will automatically unhook the pane.

Note: if you zoom a tmux pane that contains a vim session, you should be able navigate between vim windows within that tmux pane without unzooming, but if you navigate past the edge of the vim windows then tmux will unzoom. There is no logic to “wrap” or “trap” within the zoomed session.

hopefully that clarifies things, but I think given the above notes that this is working as intended and so I’m going to close this now.