Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'd like to map the keybinding Ctrl+Shift+Tab in rxvt-unicode. I managed to map Ctrl+Tab as follows. The corresponding entry in .Xresources is

URxvt.keysym.Control-Tab: \033[27;5;9~

Using cat -v confirms that this mapping works:

$ cat -v
^[[27;5;9~

The sequence ^[[27;5;9~ can then be used in applications like vim for mapping Ctrl+Tab. I would expect the following .Xresources entry to work the same.

URxvt.keysym.Control-Shift-Tab: \033[27;6;9~

However, cat does not show the correct mapping:

$ cat -v
^[[Z

How to set up the Ctrl+Shift+Tab mapping?

Edit

The mappings

URxvt.keysym.Control-ISO_Left_Tab: \033[27;6;9~    
URxvt.keysym.Control-Shift-ISO_Left_Tab: \033[27;6;9~

behave the same. After first pressing Ctrl+Tab, releasing both and then pressing Return twice and then pressing Ctrl+Shift+Tab, releasing all and then pressing Return twice I get the following output:

$ cat -v
^[[27;5;9~
^[[27;5;9~


^[[27;6;9~↵
^[[27;6;9~M-bM-^FM-5
  • Case Ctrl+Tab: The first return makes the input appear again as output.
  • Case Ctrl+Shift+Tab: The first return produces the sign , the second return produces the last line shown above.

Next edit: More information

What happens if you press ctrl-shift (release both without pressing any keys), then enter, in a different window?

In a different urxvt window? When I press Ctrl+Shift and release both keys a strident yellow box appears in the lower left corner: KEYCAP PICTURE INSERT MODE it seems to come from urxvt, it does not appear in other applications.

Or even just ctrl-shift-tab then enter in a different window (i mean not rxvt, like in a gedit window or the web browser or something.)

I get a new line.

What happens if you press shift+ctrl+tab [i.e. shift down, ctrl down, tab, ctrl up, shift up] instead, or vice versa if that was what you were doing?

In urxvt?

$ cat -v
shift+ctrl+tab then enter: ^[[27;6;9~
ctrl+shift+down: ↓
ctrl+shift+up: ↑
shift+down: ^[[b
shift+up: ^[[a
ctrl+down: ^[Ob
ctrl+up: ^[Oa
tab: |       | (tab)

I'm trying to narrow down things because I think you might have some sort of mapping on "ctrl+shift" in xcompose or something.

Not that I'm aware of, but you never know.

What is the output of xev when you press "ctrl+shift+tab, enter"?

KeyPress event, serial 32, synthetic NO, window 0x4800001,
    root 0xb4, subw 0x0, time 311734869, (567,395), root:(567,411),
    state 0x0, keycode 66 (keysym 0xffe3, Control_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 35, synthetic NO, window 0x4800001,
    root 0xb4, subw 0x0, time 311734971, (567,395), root:(567,411),
    state 0x4, keycode 62 (keysym 0xffe2, Shift_R), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 35, synthetic NO, window 0x4800001,
    root 0xb4, subw 0x0, time 311736110, (567,395), root:(567,411),
    state 0x5, keycode 23 (keysym 0xfe20, ISO_Left_Tab), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 35, synthetic NO, window 0x4800001,
    root 0xb4, subw 0x0, time 311736494, (567,395), root:(567,411),
    state 0x5, keycode 23 (keysym 0xfe20, ISO_Left_Tab), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 35, synthetic NO, window 0x4800001,
    root 0xb4, subw 0x0, time 311736525, (567,395), root:(567,411),
    state 0x5, keycode 62 (keysym 0xffe2, Shift_R), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 35, synthetic NO, window 0x4800001,
    root 0xb4, subw 0x0, time 311736525, (567,395), root:(567,411),
    state 0x4, keycode 66 (keysym 0xffe3, Control_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 35, synthetic NO, window 0x4800001,
    root 0xb4, subw 0x0, time 311737530, (567,395), root:(567,411),
    state 0x0, keycode 36 (keysym 0xff0d, Return), same_screen YES,
"   XLookupString gives 1 bytes: (0d) "
"   XmbLookupString gives 1 bytes: (0d) "
    XFilterEvent returns: False

KeyRelease event, serial 35, synthetic NO, window 0x4800001,
    root 0xb4, subw 0x0, time 311737633, (567,395), root:(567,411),
    state 0x0, keycode 36 (keysym 0xff0d, Return), same_screen YES,
"   XLookupString gives 1 bytes: (0d) "
    XFilterEvent returns: False
share|improve this question
    
I have no idea if this will work, so not posting as an answer yet, but try Control-Shift-ISO_Left_Tab or Control-ISO_Left_Tab. –  Random832 Oct 8 '12 at 14:56
    
@Random832 It is definitely a nudge in the in the right direction, but the mapping behaves weird. When I press Ctrl-Tab cat -v outputs the mentioned sequence, Ctrl-Shift-Tab outputs the correct sequence ^[[27;6;9~ however the next key press is not interpreted like usual. In the cat -v output Ctrl-Shift-Tab+ enter displays as ^[[27;6;9~↵, instead of two lines ^[[27;6;9~ (one for input, one for the output). This mapping would not work in vim. Do you have another idea? –  Marco Oct 8 '12 at 15:16
    
Like a literal ↵ symbol? Are you releasing ctrl-shift before you hit enter? Which of the two mappings I suggested worked, so I can start writing an answer? –  Random832 Oct 8 '12 at 15:23
    
@Random832 I added more detailled information (see edit). Thanks for your effort so far. –  Marco Oct 8 '12 at 15:45
    
What happens if you press ctrl-shift (release both without pressing any keys), then enter, in a different window? Or even just ctrl-shift-tab then enter in a different window (i mean not rxvt, like in a gedit window or the web browser or something.) What happens if you press shift+ctrl+tab [i.e. shift down, ctrl down, tab, ctrl up, shift up] instead, or vice versa if that was what you were doing? I'm trying to narrow down things because I think you might have some sort of mapping on "ctrl+shift" in xcompose or something. What is the output of xev when you press "ctrl+shift+tab, enter"? –  Random832 Oct 8 '12 at 22:27
show 2 more comments

2 Answers 2

up vote 1 down vote accepted

Shift+Tab is often mapped to the ISO_Left_Tab keysym in X11, so some programs may need this instead of a literal 'shift-tab' in their configuration.

urxvt has a strange mapping on ctrl+shift, it looks like you will have to recompile to disable it: see this page for more details. EDIT It looks like in recent versions of rxvt you can simply add

URxvt.iso14755_52: False
share|improve this answer
add comment

I've got S-Tab working with this :

URxvt.keysym.C-Tab: \033{
URxvt.keysym.Control-Shift-ISO_Left_Tab: \033} 
! disable ctrl-shit
URxvt*iso14755: False 
URxvt*iso14755_52: False

and in vim I have

nmap ^[{ :tabnext<cr>
imap ^[{ <ESC>:tabnext<cr>
nmap ^[} :tabprevious<cr>
imap ^[} <ESC>:tabprevious<cr>
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.