3

I'm trying to make Firefox keybindings work for tabs in vim (ssh'd into a server through OSX Terminal), however I'm running into issues.

Its basically the same as this Stack Overflow question except for Terminal in Mac not xterm:

Mapping <C-Tab> in my vimrc fails in Ubuntu

From my research, it seems some terminals don't differentiate between <C+Tab> and <Tab>, so I'm wondering if there's some way to hack around this in the Terminal app so vim can understand it. (Maybe escape sequences or something...)

Any ideas?

Community
  • 1
  • 1
C.J.
  • 239
  • 1
  • 10

2 Answers2

3

Long story short: Ctrl-Tab doesn't exist, because Tab is really already a Control key, Ctrl-i.

Short story longer: There is a way to do it, but it requires a sufficiently large amount of hackery at both the terminal and the vim level that you may or may not consider it worth it. I'm working on a much better more generic solution to it but currently I'm not quite sure the world seems to want it.

http://www.leonerd.org.uk/hacks/fixterms/ if you are interested.

LeoNerd
  • 8,344
  • 1
  • 29
  • 36
  • Why does `:nnoremap w` also switch the window if only tab is pressed? I had assumed that one needs to press ctr+tab. – newandlost Feb 23 '18 at 22:04
1

In Terminal.app's preferences, you can set some keybindings to send specific character sequences. In your case, you could set <C-Tab to send gt or whatever Vim shortcut you want.

Anyway, you'd better learn the right shortcuts.

romainl
  • 186,200
  • 21
  • 280
  • 313