Mike Mazur wrote:
Hi,
I'm running vim in a console using gnome-terminal. I put these
mappings in my .vimrc file:
map <c-q> :mksession! ~/.vim/.session <cr>
map <c-s> :source ~/.vim/.session <cr>
Pressing those buttons (CTRL+Q or CTRL+S) doesn't work.
What is causing this behavior? Is it the terminal capturing the CTRL+Q
and CTRL+S keystrokes before they reach VIM?
I can't answer with any authority here; however, I have a reasonable
guess. I run KDE on Ubuntu Linux, so I use konsole instead of
gnome-terminal. I cannot map <C-S> or <C-Q> to anything useful either.
I wouldn't be surprised if this is because these two characters are
historically used for terminal flow control. The CTRL-S character is
the ASCII control character XOFF, which pauses the terminal output until
an XON character (CTRL-Q) is received. You can see this behavior (using
konsole, at least, but I imagine almost any terminal emulator would also
work) by executing the following command:
find /usr
and then, while lots of output is scrolling by, pressing CTRL-S. The
scrolling should pause until you press CTRL-Q. You can press CTRL-C to
cancel the `find` operation when you grow tired of it.
The GUI version of Vim doesn't suffer from this limitation. I have
CTRL-S mapped to :update to match the Windows convention of mapping
CTRL-S to "Save".
Michael Henry