map Ctrl-V as Ctrl-Q in vim

If you want to map Ctrl-V as Ctrl-Q, you can add the following line in your .vimrc file

1
nnoremap <C-V> <C-Q>

It works in gvim, but it wouldn’t work in terminal-vim. Why? I’d been confused about it for a long time until I saw this:

If you want to make <c-q> work in your terminal vim, you need to understand the default <C-q> has special meaning in your terminal settings.

In your terminal, pressing <c-q> will sent stty start signal. This is important when you first stop your terminal output scrolling(by ctrl-s), and then you want to resume. That is, in terminal vim, if you pressed C-q, it will be captured first by terminal. You can of course change that rule, by disable the stty start definition. like:

stty start undef

you could add this to your .bashrc file (I assume you were using bash) if you want to make it as default.

with this line executed, you can create the same mapping nnoremap <c-q> <c-v> in your vim, and pressing <c-q> in normal mode, vim is gonna enter block-wise selection mode.

After all, again, I suggest you forget the windows mapping if you work on linux box.

In short, add the following line in your .bashrc file, and the map will work after that.

1
stty start undef
Share