views:

1103

answers:

2

I'd like to be able to map the vim commands :tabnext and :tabprev to CTRL+TAB and CTRL+SHIFT+TAB respectively. Unfortunately, I seem to be running into the problem where PuTTY eats these character combinations.

I've tried searching for information, but to no avail. I'm pretty sure this is a PuTTY thing but there doesn't seem to be any sort of help/reference area for the application.

I am curious if anyone here has any experience or suggestions for figuring this out.

@rmeador: try mapping the key combo within vim.
I have attempted to do this, but it doesn't appear like vim is getting the combo. I'm not certain if this is related to the term settings or an issue with PuTTY.

+2  A: 

I believe that at this time, using Ctrl+Tab is not possible with PuTTY, because PuTTY does not allow you to configure specific translations for keys. Here is a decent article that shows how you would set this up if PuTTY did support this feature:

http://www.staldal.nu/tech/2009/01/10/how-to-use-ctrl-tab-in-gnu-screen/

If you use (or would consider using) a hotkey/macro program like Autohotkey, you could emulate this behavior yourself. For example, this Autohotkey config script would do exactly what you want:

#IfWinActive PuTTY
^Tab::Send :tabnext
^+Tab::Send :tabprev
#IfWinActive

(Note that this example is just looking for any window title starting with PuTTY, so you'd have to adjust based on your title configuration.)

Elliot Nelson
+3  A: 

PuTTY doesn't send anything when you press CTRL+TAB.

You can patch PuTTY as it is described here: Using Ctrl+Tab in GNU Screen over PuTTY

Stormbringer
This looks to be on the right track. I've attempted the solution suggested in the link however I have run into the issue that the escape sequence suggested isn't what vim is expecting as '<CTRL-Tab>' or the like. Any idea on what the correct terminal escape sequence might be?
Danny
I have no idea. However, you could try to send the key code for F11 and F12 (or any other keys you don't use) and map those in vim to :tabnext and :tabprev.
Stormbringer
That is a good idea, hadn't thought of that. I'm going to post on the use-vim mailing group and see if I get a response. Otherwise, I'll be using that suggestion.
Danny
Vim doesn't expect ctrl-tab or ctrl-shift-tab to work in a terminal, so you'd have to tell it yourself.
graywh