I am a long time user of git bash and its included vim and mintty. I updated from an older package including vim 8.1 to one with 8.2, and I have a new problem with just two mintty shortcuts. I haven't been able to tell which change caused this, but it seems limited to vim.

Before, I could use the shortcut Ctrl-Tab inside vim, and mintty would receive that, and cycle between other mintty windows. Ctrl-Shift-Tab would do the same in reverse order. It still works except when I'm using vim, which seems to use that for changing tabs in vim.

I've seen a lot of help on how to do the opposite of this, if I had a key that I wanted to use in vim but I didn't like a terminal keyboard shortcut. I just want vim to go back to how it was before, ignoring the key so that mintty can use it. How would I make it do that?

  • I said "git bash" above, but in case that is unclear, I'm referring to the "git for windows" package that includes all of these things together. I genuinely prefer having vim running in a bunch of terminal windows. I just tested with vim 8.2 over ssh to a linux host as well (in the same terminal), and Ctrl-tab changes tabs in vim (or just flashes the screen). So that behavior is correllating with 8.2 in both places. Using vim 7.4 on a different host lets mintty use the shortcut key though. I'm pretty sure the previous version of Git for Windows had vim 8.1 packaged. – Jack May 12 at 16:26
  • Does this get fixed if you add let &t_TI = "" and let &t_TE = "" to your vimrc? See :help modifyOtherKeys, I suspect that's the feature that is causing Ctrl+Tab to get captured by Vim, also seems to match the upgrade to 8.2, I know that's a recently added feature... – filbranden May 12 at 18:42
  • 1
    Yes!! That did the trick. I did as you said, and then quit and started vim again. Testing the change from an ex style command, sourcing the updated vimrc, or doing a shell out didn't make the difference to the terminal (yet), but after the stop & start, I could ctrl-tab again. Thanks a million!! – Jack May 12 at 22:29

The new behavior you're seeing is due to the new modifyOtherKeys feature, which has applications such as Vim announce to the terminal that they would like to receive extended and expanded escape sequences for keypresses with modifier keys (Ctrl, Alt, Shift, etc.)

For example, this allows Vim to differentiate Ctrl+I from Tab, or Ctrl+[ from Esc, but it also allows Vim to recognize key sequences using both Ctrl and Shift modifiers together, for example, distinguish Ctrl+Shift+A from Ctrl+A, which has traditionally not been possible to do in a terminal.

As you've noticed, this also affects the Ctrl+Tab sequence, which the terminal starts passing to the application (in this case Vim) while the application has the modifyOtherKeys mode enabled.

Vim support for the modifyOtherKeys feature was introduced in Vim 8.2, so this seems to match your experience of having this behavior started around the time when you upgraded.

If you'd prefer to disable this feature, in order to keep your terminal processing the Ctrl+Tab sequence by switching terminal tabs, you can do so by adding these two lines to your vimrc:

let &t_TI = ""
let &t_TE = ""

You can find these instructions under :help modifyOtherKeys. Note that these two lines disable this feature altogether, so you don't get all the other benefits of having Vim receive and be able to interpret an expanded list of key sequences.)

(If you'd like to keep this feature generally enabled, but have the terminal still handle the Ctrl+Tab events, you might want to consider filing an issue on mintty about perhaps adding an option for this, after all, the terminal could make it configurable which keys are passed to the application, even under modifyOtherKeys.)

Your Answer

