2

I have the following in a .vimrc file:

vmap ; :Blockwise<SPACE>

I'm not sure what the Blockwise key word does.

6
  • 1
    I can't find it in the documentation, maybe it's part of a plugin?
    – Tumbler41
    Feb 15, 2017 at 16:47
  • 1
  • :verb vmap ; to see where it is defined. Must be a plugin, so read its description. Feb 15, 2017 at 18:17
  • 1
    If you don't know what it does, why do you have it in your .vimrc? Feb 15, 2017 at 18:29
  • 1
    @ChristianBrabandt He said in a .vimrc file not specifically his .vimrc Feb 16, 2017 at 10:39

1 Answer 1

2

It's an Ex command, and since its first character is written in uppercase, it's probably a custom command.

To see what it does, and where it was defined, you can use this command:

:verbose command Blockwise

… or shorter:

:verb com Blockwise

By default, an Ex command operates on whole lines.

So, for example, suppose you wanted to perform a substitution inside a column in a paragraph. You could visually select it, then type :s/pattern/replacement/g. You could think that the substitution command would replace the occurrences of pattern with replacement only inside the block, but since Ex commands operates on whole lines, :s would replace pattern anywhere in the paragraph, not just inside the column you selected.

As a workaround, inside the pattern, you could use the atom \%V (see :h /\%V), but it may not be always as simple for other commands (other than :s).

With your mapping, if you hit ; in visual mode, Vim will write on the command line :'<,'>Blockwise.

So, it's just a guess, but your :Blockwise command probably expects as an argument another command, and limits the effect of the latter on a visual blockwise selection. It may be a mechanism to enable all or most of Vim Ex commands to operate on blockwise selection, and not just whole lines.

With it, you could probably do something like:

:'<,'>Blockwise s/pattern/replacement/g

… to replace pattern with replacement, only inside the visual block.


When you find the name of a command which you don't know, you can try to look for it inside the help, with the :helpgrep or :lhelpgrep command. The latter can be shortened into :lh. Currently, if I type:

:lh :Blockwise

I don't have any results, so with this you would know it's not a default Vim command. However, if it has been installed with a plugin which has some documentation, then it's possible that the previous command returns some results.


You probably want to replace :vmap, with :xnoremap. In front of a :map command, v doesn't mean visual mode, it means visual mode+select mode. x stands for visual mode only. So, if you use :vmap, you will bind a printable character (;) in select mode. And the help says that it could be confusing to a user (:h mapmode-x):

NOTE: Mapping a printable character in Select mode may confuse the user.

You could change your mapping like this:

xnoremap ; :Blockwise<Space>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.