Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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

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.