Creating a ctrl+tab keybinding in PuTTY
Asked Answered
C

2

18

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.

Cernuous answered 9/4, 2009 at 21:34 Comment(5)
serverfault.com will be up and running soon. This is a question for that site. So keep hold of your question for a few more weeks, then you can ask it.Do
try mapping the key combo within vim. voting to close as NPRShuttlecock
Although not directly a programming question, I believe it is closely tied into what some may do on a day to day basis. And therefore a relevant posting.Cernuous
Until serverdefault is up (and even then) I don't think we should be modding down questions about tools programmers use. So, modded up.Aubreyaubrie
Agreed, this is a programming question in that Danny is using PuTTY+vim for programming, and is having a problem. I think the community has already decided that questions about vim are okay (see the other 368 vim questions). So why not this one?Leonialeonid
H
8

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

Howes answered 25/4, 2009 at 19:46 Comment(4)
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?Cernuous
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.Howes
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.Cernuous
Vim doesn't expect ctrl-tab or ctrl-shift-tab to work in a terminal, so you'd have to tell it yourself.Glycine
S
1

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.)

Stealthy answered 10/4, 2009 at 6:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.