Ubuntu – How to map Ctrl+S in vim on gnome-terminal

12.04gnome-terminalvim

I'm using Ubuntu 12.04 and gnome-terminal 3.4.1.1, and I'm trying to map ctrl + s to :update in vim.

I added this to my vimrc: map <C-s> :update<CR>

I also tried adding this to my bashrc: stty -ixon -ixoff

However, the terminal still seems to override my keymapping.

Best Answer

You can disable Ctrl-S in a terminal by:

stty stop undef

You can put this line in your ~/.bashrc file to make the change permanent. You can also reenable Ctrl-S with:

stty stop ^s