Customizing Key Binds for vim

Asked 2 years ago, Updated 2 years ago, 107 views

When selecting a rectangle in vim, it is troublesome to change it to visual block mode in ctrl+v, so I would like to select a rectangle like vscode in ctrl+ arrow keys.

linux vim

2022-09-30 15:49

1 Answers

I think you can do it with the following settings.
The first four lines are required to start rectangular selection with each arrow key.
The last four lines are required to select one character at a time with the arrow keys holding down Ctrl+Alt even after you start selecting.(However, Vim is already in selection mode, so you can select only the arrow key without pressing the modifier key.)

noremap<C-A-Right><C-v>Right>
noremap <C-A-Left><C-v><Left>
noremap <C-A-Up><C-v><Up>
noremap <C-A-Down><C-v><Down>
vnoremap <C-A-Right><Right>
vnoremap<C-A-Left><Left>
vnoremap <C-A-Up><Up>
vnoremap <C-A-Down><Down>


2022-09-30 15:49

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.