christoomey / vim-tmux-navigator

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

Shift Enter breaks tmux navigator #344

Closed anichols-ht closed 1 year ago

anichols-ht commented 1 year ago

First of all . . . love tmux navigator (thank you!). So much so that when something goes wrong, I have a hard time adjusting back to hjkl mappings.

I thought at first this was a problem with fern cause I started noticing it when using fern, but after a bit of debugging, it turns out that by itself (regardless of other plugins and whether that key combo has a mapping or not) causes tmux navigator to permanently no longer work in the vim session I'm in. I have to quit vim and relaunch to get them back (I could probably re-source it, but I haven't tried that). Seems weird, but I can reproduce it consistently.

christoomey commented 1 year ago

Hey @anichols-ht - thanks for the kind words!

Can you add any specifics about the failure mode, and did happen to try anything describe in the Troubleshooting section?

Based on what you're describing (it works in a fresh Vim, but then stops working at some point), I'm guessing something is overriding the mappings or changing the process name.

anichols-ht commented 1 year ago

Yeah, I should've included that in the initial report. verbose nmap <c-h> (I chose h when I tried it) still reports tmux navigator; it just doesn't work. Just checked TmuxNavigatorProcessList and it shows:

Ss  -bash
S+  vim
S+  /bin/bash
S+  tmux

This definitely still could be environmental or user error, but I'm not sure what else to check.

christoomey commented 1 year ago

Process list and mappings look right, so doesn't seem to be those.

Next things to check:

anichols-ht commented 1 year ago

The mapping does not get triggered and the vim functions do work, so I think that must indicate something else is the problem. Shift-Enter just seems to stop Ctrl-hjkl from working. But it doesn't prevent other Ctrl bindings from working. I can still do Ctrl-w hjkl to move around (this is the weirdest part I think . . . it's so selective). I use terminal vim, so maybe it just doesn't like Shift-Enter for some reason.

anichols-ht commented 1 year ago

I now suspect it has something to do with this: https://unix.stackexchange.com/questions/520273/setting-xterm-keys-in-tmux-affects-shift-enter-in-vim. I do have xterm-keys on in tmux. (This might require a new entry in your troubleshooting...)

anichols-ht commented 1 year ago

Okay. Turning off xterm-keys did not fix it, but removing Send ^[ [13;2u Shift Return from iterm2 key mappings did (though of course Shift-Enter no longer works for mappings).

christoomey commented 1 year ago

Sounds like this is coming from your xterm config rather than the plugin? Don't want to close preemptively, but assuming that's accurate, I'm thinking we can close this issue.

anichols-ht commented 1 year ago

No, I agree with you. I only left it open cause I thought you might have experience with terminal escape sequences and say something like "Oh, you just need to do ." But yes, we can close this. Thanks for taking the time to chat about it!