Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Maybe I'm searching the wrong way, but I've failed to find out how to do this.

Here's the scenario: I have a list in a text file where I want to insert the same word on multiple lines, here's an example text:

12.1           Item1
12.2           Item2
12.3           Item3

Now I visual-block mark the 8th column, indicated with underscores below, and intend to replace part of the whitespace with Done without moving the item column:

12.1   _       Item1
12.2   _       Item2
12.3   _       Item3

I expected that I could go into replace mode, but I can only enter insert (I), append (A), or change-mode (c). The change-mode comes close to what I want: if I know the length of the word the block can be set to the same width.

Is there something I'm missing here?

share|improve this question
up vote 10 down vote accepted

Why don't you select 4 columns and hit c?


Also, you could use :h normal:

:'<,'>norm 7lRDone
share|improve this answer
That works for Done, but what if I want to write something else, I want to be free from counting characters, if possible. – Thor Sep 11 '12 at 12:16
:norm is your friend, then. – romainl Sep 11 '12 at 12:20
Yes the second solution can be used for a convenient mapping. Thank you. – Thor Sep 11 '12 at 12:23

If you want to substitute within a visual block, you can use the vis.vim plugin.

To install:

Download vis.vba.gz from

# Open vis.vba.gz in Vim 7.1 or later.
vim vis.vba.gz

# Source the open file.
:so %

# Quit Vim

Once installed:

ctrl-v to enter visual-block mode
Move to select the block you want
:B s/pattern/newtext/

Even better, you can perform any Ex command on the visual block, not just substitutions. For example :B !sort.

share|improve this answer
Nice plugin, I will be using it :-). But how can I use it to replace arbitrary columns? – Thor Nov 6 '15 at 21:21
Right, you still have the problem of quickly setting the visual block width to match your arbitrary-width columns. I usually do <count> w or e to select several columns quickly, then adjust with h or l. – Christian Long Nov 6 '15 at 21:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .