Skip to content

2. Starting VM

mg979 edited this page Aug 31, 2019 · 6 revisions

Imgur Imgur


VM can be started in several ways.

As usual, leader- is your g:VM_leader (default \\).

If g:VM_default_mappings is true (default 1), the following mappings will be available:

C-n adds a word under cursor, keep pressing to find next occurrence
C-Down / C-Up start adding cursors downwards/upwards, skipping empty lines
leader-A select all words in the file
leader-/ start regex search
leader-\ add cursor at position
leader-gs select operator: eg. gs$ will select until end of line

Some other mappings work from visual mode:

C-n add the visually selected pattern
leader-a add the visually selected region
leader-f find all current search patterns (from the / register)
leader-c create a column of cursors

Other mappings are not enabled by default, but you could add them to your vimrc. For example:

let g:VM_maps = {}
let g:VM_maps['Find Under']         = '<C-d>'           " replace C-n
let g:VM_maps['Find Subword Under'] = '<C-d>'           " replace visual C-n
let g:VM_maps["Select l"]           = '<S-Right>'       " start selecting left
let g:VM_maps["Select h"]           = '<S-Left>'        " start selecting right
let g:VM_maps["Select Cursor Down"] = '<M-C-Down>'      " start selecting down
let g:VM_maps["Select Cursor Up"]   = '<M-C-Up>'        " start selecting up

Here you find the full list of mappings.


Find/Goto next/previous

After VM has started, buffer mappings will be enabled, among which:

] find next
[ find previous
} goto next
{ goto previous
C-f fast goto next
C-b fast goto previous
q skip and go to next
Q remove region
s select operator
m find operator

Skip regions

Key q is used to skip a region and go to the next one. 'Next' does not mean necessarily downwards, it depends on the current searching direction, that can be changed with keys { and }.

Key Q will remove the region under cursor, but will not proceed to the next one. Will instead fall back to the previously selected region.