Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

I'd like to overload both Ctrl+S and Cmd+S to save a file if I happen to be editing something in Vim.

After some head-scratching I think I've discovered that ^S in a terminal is perhaps being caught by the shell for sending a signal to the process, or perhaps Vim is doing something special to not listen to it. I have a perl script that puts the term in raw mode which can read my mappings just fine (the ^S sends hex 0x13), but nothing happens when I am in Vim Ctrl+V verbatim-mode and type it. In the bare zsh shell, verbatim-mode does show me that I am pressing ^S. This seems to refute the proposition that there is some terminal program flow-control bound to this key, as I am able to get zsh to see it.

How can I get vim to recognize my Ctrl+S?

share|improve this question

^S is the ASCII XOFF character. Together with XON (^Q), they are the two control signals used for software flow control.

They are not intercepted by the shell, but by the terminal, which intercepts ^S to mean halt terminal output and ^Q to mean resume it.

You can configure your terminal (using stty -ixon -ixoff) to ignore them by turning off software flow control, but it may be futile: it's ill-advised to attempt to assign other functions to XON and XOFF because there might be something else in the user's session (a remote terminal, a modem, some other piece of RS-232 equipment) that interprets them.

share|improve this answer

stty -ixon (and stty -ixoff for good measure) did it for, iTerm2.

share|improve this answer

Your Answer


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.