Vim - Visual Block : Delete rather than insert

henry.oswald picture henry.oswald · Jul 4, 2011 · Viewed 11.3k times · Source

I often use visual block then inserting on multiple lines when for example commenting out a lot of code. This is great for inserting text in the same position on multiple lines but I can't figure out how to delete this text later using visual block mode, Backspace, Del and d all don't work. I am using MacVim.

Answer

sarnold picture sarnold · Jul 4, 2011

You're looking for x:

root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
sys:x:3:3:sys:/dev:/bin/sh

Then visual-block-select, x:

root:/root:/bin/bash
daeaemon:/usr/sbin:/bin/sh
bin/bin:/bin/sh
sys/dev:/bin/sh

I use this frequently, for exactly the same reason -- commenting and uncommenting large blocks of code.