Skip to content
mg979 edited this page Apr 11, 2019 · 11 revisions

Imgur


Welcome to vim-visual-multi (VM from now on)! This is a very ambitious plugin that tries to bring the true multiple cursor experience to vim, without compromises. That is, without renouncing to any of the features you see in other editors' multiple cursors implementations. It's, for now, in beta state: all features are there, but some can be improved, and there are still bugs to fix/imperfections to iron out. Please have patience if you find bugs, and open an issue in the issues tracker.

Due to the nature of vim, multiple cursors here can be more powerful than those you have in other editors: you can add them, skip them, navigate throught them back and forth, remove them one by one, jump to another part of the file and add them at arbitrary positions, turn cursors into selections or collapse selections into cursors, move cursors/extend all selections with motions, resize individual selections, add regions with regex, select all words/regex patterns... And much more.

Extra features mimic some popular features of other editors, some of which only provided by extensions for the said editors:

  • text alignment (at cursors, by character or regex)
  • text transposition (synched inline, or cycling)
  • text shift (move selected text left and right)
  • numbering with expressions and separators
  • run macros/normal/visual/ex commands at cursors
  • built-in integration with vim-surround
  • select operator (select with motion, works with any custom operator)
  • find operator (find occurrences in text objects)

Important: mappings you can see in pictures may be outdated, so don't trust pictures for mappings.


Master and test branches

Important: The master branch could be behind the test branch.
Currently recommended branch: master

To install VM with vim-plug using the test branch, add to your vimrc in the plugs section:

Plug 'mg979/vim-visual-multi', {'branch': 'test'}

There's also a configuration tool. To start it:

:VMConfig

Nor the master or the test branch are bug free. There is also a devel branch but you shouldn't use it, unless otherwise advised.


Some usage examples.


Mappings

There are a lot of new defined mappings: most of them are <buffer> mappings, that are unmapped when you exit VM mode. Mappings in this wiki aren't up always to date, especially in animated gifs.

Pay attention: VM uses its own leader (g:VM_leader), and in most pages, leader- is your g:VM_leader (default \\).

More about mappings here