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?

  • Are you having problems with all Control-key mappings, or just some? – Heptite Dec 31 '10 at 8:21

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

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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