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

Important: now VM has its own documentation in help format, please refer to that to learn to use the plugin. This wiki will be kept for screenshots but consider it outdated for everything else.


Welcome to vim-visual-multi (VM from now on)! This is another attempt at bringing multiple cursors/selections to Vim. Its implementation is different from most other multiple cursors systems, due to how Vim works and what it allows.

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...

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

  • switch between cursor mode and selection mode (with Tab)
  • text alignment (at cursors, by character or regex)
  • text transposition (synched inline, or cycling)
  • text shift (move selected text left and right)
  • 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

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'}

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 cannot be trusted for mappings.

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