To ensure that this workaround runs even when Vim is started by a separate tool (such as git), I have this in my
" Allow us to use Ctrl-s and Ctrl-q as keybinds
silent !stty -ixon
" Restore default behaviour when leaving Vim.
autocmd VimLeave * silent !stty ixon
This has been working for me on Linux, GVim, Mac OS X and MacVim.
On Windows, or any other OS lacking the
stty command, the above will likely throw up errors every time Vim starts! (
silent! might mute that.)
If your shell already had this TTY setting disabled, of course the
VimLeave autocommand will turn it back on again! iProgram's approach manages that by detecting the settings at startup.
A combination of this and iProgram's solution, which handles compatibility concerns under OS X and Windows, would be great to post up here and/or on the Wiki!
To avoid choosing between
stty -g and
stty --save, you could try the following test for just the
call system("stty -a | grep '\( \|^\)ixon\>' >/dev/null")
let g:ix_at_startup = (v:shell_error == 0)
I am also running vim inside the Mac terminal.' Yes I am running vim via terminal. Would it be better using Alt instead of Ctrl or Cmd?
<D-s>although I'm not sure if that works in terminal Vim, and it is already a default in MacVim anyway!