christoomey / vim-tmux-navigator

Seamless navigation between tmux panes and vim splits
MIT License
5.28k stars 325 forks source link

Update `is_vim` detection logic for tmux 3.2 #300

Closed christoomey closed 2 months ago

christoomey commented 3 years ago

Users upgrading to tmux 3.2 have been reporting issues with using the plugin, specifically that it would "freeze" their terminal for 30+ seconds.

@kidonchu kindly provided an updated version of the is_vim check that seems to resolve the issue, so this PR updates the README and TPM script to use that version.

christoomey commented 3 years ago

@dkarter thanks for the note! I'm also looking to confirm if this version of the snippet is reasonably backwards compatible, so hoping to hear from folks on tmux < 3.2 to validate that, so will likely need to keep this open for a bit.

mhartington commented 2 years ago

👋 Hello! So I gave this a shot on my setup with tmux 3.2, but I think the issue is still there.

  is_vim="ps -o state=,tty=,comm= | grep -iqE '^[^TXZ ]+ +#{s|/dev/||:pane_tty}\s+(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
  bind -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
  bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
  bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
  bind -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"

With this plus the typical vim keybindings, it seems to skip over vim splits and goes directly to changing tmux panes.

EDIT: Turns out fig was causing some issue where it modified the results from TmuxNavigatorProcessList. Uninstalled and everything worked fine.

unphased commented 2 years ago

~Hi could you clarify what fig is?~ never mind.

yut23 commented 2 years ago

This doesn't work for me on Fedora 34 (using ps from procps-ng 3.3.17), but passing -a to ps fixes it. Without that, it seems to just list all the processes with no connected terminal.

sullivan-sean commented 2 years ago

👋 Hello! So I gave this a shot on my setup with tmux 3.2, but I think the issue is still there.

  is_vim="ps -o state=,tty=,comm= | grep -iqE '^[^TXZ ]+ +#{s|/dev/||:pane_tty}\s+(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
  bind -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
  bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
  bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
  bind -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"

With this plus the typical vim keybindings, it seems to skip over vim splits and goes directly to changing tmux panes.

EDIT: Turns out fig was causing some issue where it modified the results from TmuxNavigatorProcessList. Uninstalled and everything worked fine.

I think this approach https://github.com/christoomey/vim-tmux-navigator/issues/295#issuecomment-922092511 should fix incompatibility with Fig