I'm trying to understand how the visual-block mode deals with Backspace and Delete, and if it is possible to vertically select a column of text, delete some characters, then insert new ones in a single selection.
For example, with these 3 lines of code (each proceeded with 2 spaces):
a = 1;
b = 2;
c = 3;
With my cursor on a
I press Ctrlvjj selecting all the letters, then I to go into insert mode. At this point I can delete the two preceeding spaces with Backspace then start typing var
but when I hit Esc I get the following:
var a = 1;
r b = 2;
r c = 3;
I don't understand why Vim is not including the va
on the last two lines. I ran some other tests with Backspace and the Delete key and noticed that neither of these actions are applied to other lines, however I would then expect something like:
var a = 1;
var b = 2;
var c = 3;
What is the multiline cursor doing that causes va
to be overwritten/ignored? Also, I know that I can select the two columns of spaces and delete them with d then reselect the three lines and type var
, but is there a way to do this only having to make the selection once?
I've tested this without a vimrc