Vim: use ctrl-Q for visual block mode in vim-gnome

I am using vim for windows and linux. In linux, I would like to install ctrl-Q to select the visual block, but still support the mswin behavior, which sets ctrl-v to insert.

How can I keep running mswin and use ctrl-Q for visual block mode?

edit: Although mswin also displayed ctrl-Q in visual block mode, in vim-gnome ctrl-Q does nothing

+4
source share
2 answers

First of all, I highly recommend that you forget the vim windows shortcuts if you work in the linux box . such as: ctrl-v, ctrl-q, ctrl-c ...

, , . "".

ctrl-q ctrl-v (block selection) linux, , gvim vim .

Gvim

gvim, , , :

nnoremap <c-q> <c-v>

Terminal Vim

, <c-q> vim, , <c-q> .

<c-q> stty start. , stop ( ctrl-s), . , vim, C-q, . , , , stty start. :

stty start undef

.bashrc (, bash), .

nnoremap <c-q> <c-v> vim <c-q> , vim .

, , , linux box.

+9

(stty start undef, ctrl q, ), ctrl v , ctrl v :

" Paste from clipboard when in insert mode.
imap <C-V> <ESC>"+gpa
" Paste from clipboard when in visual mode. (Replace whatever is selected in visual mode.)
vmap <C-V> "+gp

:

" Copy selection to clipboard when in visual mode.
vmap <C-C> "+y
+1

Source: https://habr.com/ru/post/1527145/


All Articles