aurelienC
aurelienC

Reputation: 1183

Vim - Add in visual block selection

there is something I often try to do in Vim and either I'm not using the right method or it is not possible without a plugin:

Appending text to several lines at the same time in visual block selection.

For exemple:

[1] 
[2]
[3]
[4]
[5]
[6]

// I want to select all the numbers in a visual block, press 'a' then append 0
// And get this ->

[10]
[20]
[30]
[40]
[50]
[60]

To get around this issue right now I would go to the closest identical char I can find, press 's' and then append the deleted char + the char I want to add. Or use a macro.

If you know how to do this properly or if you can link me to a plugin that allows
[ visual block -> 'a' ] let me know!

Upvotes: 1

Views: 80

Answers (2)

romainl
romainl

Reputation: 196476

You are almost there, it's A, not a.

You can also use I to prepend, see :help blockwise-operators.

Upvotes: 5

Ohad Eytan
Ohad Eytan

Reputation: 8464

Select the block and then use:

:norm a0

Upvotes: 0

Related Questions