On Tue, 2 Oct 2012, Marc Lehmann wrote:

On Tue, Oct 02, 2012 at 03:27:12PM +0200, Marco <[email protected]> wrote:
ctrl-tab mappings work fine in gvim, but fail in console vim with urxvt. Example:

Well, gvim doesn't run in a terminal.

map <c-tab> <ESC>iFoo
Hitting ctrl-tab prints “Foo” in gvim, but it fails in console vim.

I guess you need to find out what vim expects to receive for c-tab, and then configure urxvt to emit this sequence.

It's me who is clueless here. Frankly I don't know much about key codes and terminals.

While I probably fare better in that respetc, and even use vim myself, I also don't know what vim expects as a sequence, and don't know a good way of finding out, short of reading the source (with luck, it's hidden somewhere in the docs).

Console Vim doesn't expect it at all. There's t_kB "back-tab", which is the termcap entry used for <S-Tab>, but nothing for <C-Tab>.


properly. As least, as I understand you, I don't have to change my terminal and it's possible with urxvt. Maybe you can help me with the configuration?

It is possible if vim supports it - the basic question is what sequence does vim expect for c-tab.

If vim doesn't support it at all, then you can still invent your own fantasy sequence and bind that one to the command though, so no matter what, there should be a way to get whatever you want working.

When I've found sequences like this that don't have termcap/terminfo (historical) counterparts, I've tried to do what XTerm's "modifyOtherKeys" mode does. It uses CSI Ps[;Ps[;Ps]] ~ to provide a more extensible set of key codes. (And, for better or worse, since it's XTerm, it may well become a de facto standard.)

In the case of Ctrl+Tab, it produces (spaces added):

CSI 27 ; 5 ; 9 ~
27 = extended key (...I think)
5 = Ctrl ( 2 = Shift ; 6 = Ctrl+Shift ; etc. )
9 = ASCII code for Tab

So, you can add to your .Xresources/.Xdefaults:

URxvt.keysym.C-0xFF09: \033[27;5;9~

(0xFF09 = keycode for Tab according to `xev` -- is there a simpler way? "C-Tab" didn't work.)

And add to your .vimrc:

map <Esc>[27;5;9~ <C-Tab>

Then the sequence will be mapped to <C-Tab>, which Vim can then interpret properly.

--
Best,
Ben
_______________________________________________
rxvt-unicode mailing list
[email protected]
http://lists.schmorp.de/cgi-bin/mailman/listinfo/rxvt-unicode

Reply via email to