I\'m really fond of this idea of using Ctrl-V (Ctrl-Q in windows) to modify a visual block. The technique is explained here: In
It may be as simple as not having the right package installed. Visual block mode is not included in vim-minimal
which is often the default version of vi. If you do this:
rpm -qa | grep vim
and you see vim-minimal
but not vim-enhanced
, then you have to install vim-enhanced
. That will get you visual block mode as well as many other additional features.
The behavior you describe with gvim on windows is quite unexpected. I would expect the inserted text to appear only before the first line. If you do want to insert a string before all the lines of the currently selected visual block, the natural thing to do is:
:s/^/inserted text
(Note that when you type :
, vim will automatically set the addresses with :'<,'>
, so the actual command will be :'<,'>s/^/inserted text
)
The source of the problem was lack of compiled support (thanks to my shared hosting provider). For others who are having a similar problem, check vim for the +visualextra option. You can check from normal mode with:
:echo has('visualextra')
It will return a "1" if it does. Otherwise you can look using:
:version
Or by invoking the --version option from the commandline:
vim --version | grep visualextra