Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

On gvim I can used

imap <C-s> <ESC>:w
imap <C-c> and etc...

But I cant on vim (terminal) used the imap? How can i use the some imap on the terminal?

share|improve this question
Are you having problems with all Control-key mappings, or just some? – Heptite Dec 31 '10 at 8:21
up vote 4 down vote accepted

The imap command works fine in a terminal. The problem is that a terminal treats some control characters specially, using them to control terminal behavior, and does not forward those characters to the application running in the terminal. Ctrl-S and Ctrl-Q are normally used for flow control. Ctrl-C normally causes an INTR (interrupt) signal to be sent to the application.

Applications can tell the terminal to not treat certain characters specially and to forward them instead. Vim handles Ctrl-C itself and you should be able to imap it. (I just tried it and it worked for me.) Vim does not tell the terminal to forward Ctrl-S and Ctrl-Q, however, so you would have to tell the terminal to do that yourself. One way is to execute this command at the shell prompt before running vim:

stty -ixon
share|improve this answer

You must log in to answer this question.

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