Is it possible to map sequence with Ctrl-Shift in Gnome Terminal?

I'm trying to add the mappings

  • map <C-S-[> gT
  • map <C-S-]> gt

and it's not working. How to do that?

Somehow I mapped <C-S-]>, but it turned out it's not <C-S-]>, but <C-]>, so it looks like it doesn't recognize Shift in this sequence. It's misconfigured or it's gnome-terminal's fault?

Besides. Mapping <C-[>, after pressed, looks like vim is waiting. I suppose it's mapping timeout, but how to get rid of this timeout when I press precisely <C-[> and I don't want to press anything else?

I just started learning vim, so sorry if there is something obviously wrong in that mappings.

5 Answers 5


I think the problem here is that you are trying to get vim, which expects to run in a terminal, to recognize a CTRL-SHIFT sequence. While it's possible for X to recognize such combinations, applications that run in a terminal (or, these days, a terminal emulator) cannot. This is because, historically, terminals could only send and receive seven- or eight-bit sequences of ASCII data across a serial connection (though this could include "escape sequences" that position the cursor, scroll or delete lines, change color and other helpful effects).

There are 32 "Control Codes" in the ASCII character set, including the familiar CTRL-A through CTRL-Z. But there are no corresponding ASCII codes for "CTRL-SHIFT" A through Z. Now, gnome-terminal itself can recognize these codes (CTRL-SHIFT-V, for instance, will paste text from the clipboard), but vim will not be able to have direct access to it.

Of course, it may be possible (I don't know) for a terminal emulator to be set up to convert CTRL-SHIFT key presses to an escape sequence which can then be recognized by a vim mapping.



You might be interested in gvim, which is a graphical version of vim that runs as an X program rather than a terminal program. Maybe gvim will be able to understand CTRL-SHIFT codes?


As Bartleby pointed out this is a terminal restriction, because vi sees the keycodes as being the same.

For terminals such as xterm you can change that. For gnome-terminal which ignores the X resources settings I don't know how to do the following:

This SO question covers the same topic, and this example shows this in use for mapping multiple keys in the .Xresources file. E.g.:

XTerm*vt100.translations: #override \
  Ctrl ~Meta Shift <Key>a: string(0x1b) string("[65;5u") \n\
  Ctrl ~Meta Shift <Key>b: string(0x1b) string("[66;5u") \n\ 
  Ctrl ~Meta Shift <Key>f: string(0x1b) string("[70;5u")  

Now we have different key sequences coming into vi for Ctrla vs. CtrlShifta, Ctrlb vs. CtrlShiftb, Ctrlf vs. CtrlShiftf.

We can now map them differently in ~/.vimrc:

map <ESC>[66;5u   :echo "ctrl-shift-b received"<CR>
map <ESC>[70;5u   :echo "ctrl-shift-f received"<CR>
map <C-b>         :echo "ctrl-b received"<CR>
map <C-f>         :echo "ctrl-f received"<CR>
  • The original question was about gnome-terminal, whereas your response refers to xterm.
    – egmont
    Sep 22, 2015 at 19:33
  • @egmont: Good point, and an oversight on my side. According to this answer the .Xresources are ignored by gnome-terminal. That is unfortunate. Updated answer.
    – cfi
    Sep 23, 2015 at 5:55
  • Slightly reworded/crossposted this answer as a Q&A pair to SuperUser, because I should probably delete it here because it does not apply to the asker's terminal.
    – cfi
    Sep 23, 2015 at 6:22

Seems to be an issue with GNOME Terminal not allowing certain combinations with the Ctrlkey. Searching online shows a lot of cases of this.

Just in case you don't know, Ctrl+page up/page down cycles through tabs.


It seems you just have to disable all keyboard shortcuts in gnome-terminal.

  • 2
    Why does disabling keyboard shortcuts help? Jan 24, 2013 at 1:45
  • It does not seem to help at all, from my experience. Mar 25, 2014 at 21:37

In gnome-terminal the escape sequences generated by keys are not configurable. For many keys Ctrl+key and Shift+Ctrl+key generate different sequences; unfortunately for [ and ] they don't, so you can't distinguish them.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .