Github url


by terryma

True Sublime Text style multiple selections for Vim

7.5K Stars 250 Forks Last release: Not found MIT License 269 Commits 20 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:


Build Status



There have been many attempts at bringing Sublime Text's awesome [multiple selection][sublime-multiple-selection] feature into Vim, but none so far have been in my opinion a faithful port that is simplistic to use, yet powerful and intuitive enough for an existing Vim user. [vim-multiple-cursors] is yet another attempt at that.

It's great for quick refactoring


Vim command sequence:


Add a cursor to each line of your visual selection


Vim command sequence:

vip<c-n>i"<right><right><right>",<esc>vipgJ$r]Idays = [</esc></right></right></right></c-n>

Match characters from visual selection


Vim command sequence:


Use the command to match regexp


To see what keystrokes are used for the above examples, see the wiki page.


Install using [Pathogen], [Vundle], [Neobundle], [vim-plug], or your favorite Vim package manager.

Requires vim 7.4 or newer for full functionality.

vim-plug instructions

  1. Paste this block into the top of

Plug 'terryma/vim-multiple-cursors'

call plug#end() ```

1. Start vim and execute 



## Quick Start

### normal mode / visual mode

- start: 

 start multicursor and add a _virtual cursor + selection_ on the match
  - next: 

 add a new _virtual cursor + selection_ on the next match
  - skip: 

 skip the next match
  - prev: 

 remove current _virtual cursor + selection_ and go back on previous match
- select all: 

 start multicursor and directly select all matches

You can now change the _virtual cursors + selection_ with **visual mode** commands. For instance:








 work without any issues. You could also go to **normal mode** by pressing 


 and use normal commands there.

At any time, you can press

 to exit back to regular Vim.

**NOTE**: start with


 to match without boundaries (behaves like 


 instead of 


### visual mode when multiple lines are selected

- start: 

 add _virtual cursors_ on each line

You can now change the _virtual cursors_ with **normal mode** commands. For instance:


### command

The command


 accepts a range and a pattern (regexp), it creates a _visual cursor_ at the end of each match. If no range is passed in, then it defaults to the entire buffer.
## Mapping

If you don't like the plugin taking over your key bindings, you can turn it off and reassign them the way you want: ```viml let g:multi_cursor_use_default_mapping=0

" Default mapping let g:multi_cursor_start_word_key = '<c-n>'
let g:multi<em>cursor</em>select<em>all</em>word<em>key = '<a-n>'
let g:multi</a-n></em>cursor<em>start</em>key = 'g<c-n>'
let g:multi<em>cursor</em>select<em>all</em>key = 'g<a-n>'
let g:multi<em>cursor</em>next<em>key = '<c-n>'
let g:multi</c-n></em>cursor<em>prev</em>key = '<c-p>'
let g:multi<em>cursor</em>skip<em>key = '<c-x>'
let g:multi</c-x></em>cursor<em>quit</em>key = '<esc>'

**NOTE:** Please make sure to always map something to


, otherwise you'll have a tough time quitting from multicursor mode.
## Settings

Currently there are four additional global settings one can tweak:



 (Default: 1)

If set to 0, insert mappings won't be supported in _Insert_ mode anymore.



 (Default: 0)

If set to 1, then pressing


 in _Visual_ mode will quit and delete all existing cursors, just skipping normal mode with multiple cursors.


 (Default: 0)

If set to 1, then pressing


 in _Insert_ mode will quit and delete all existing cursors, just skipping normal mode with multiple cursors.


 (Default: see below)

{'@': 1, 'F': 1, 'T': 1, '[': 1, '': 1, ']': 1, '!': 1, '"': 1, 'c': 1, 'd': 1, 'f': 1, 'g': 1, 'm': 1, 'q': 1, 'r': 1, 't': 1, 'y': 1, 'z': 1, '': 1}

Any key in this map (values are ignored) will cause multi-cursor _Normal_ mode to pause for map completion just like normal vim. Otherwise keys mapped in normal mode will "fail to replay" when multiple cursors are active. For example:


 makes normal-mode command 


 work in multi-cursor mode.

The default list contents should work for anybody, unless they have remapped a key from an operator-pending command to a non-operator-pending command or vice versa.

These keys must be manually listed because vim doesn't provide a way to automatically see which keys _start_ mappings, and trying to run motion commands such as


 as if they were operator-pending commands can break things.


 (Default: see below)

{'T': 1, 'a': 1, 't': 1, 'F': 1, 'f': 1, 'i': 1}

Same principle as


### Interactions with other plugins






Other plugins may be incompatible in insert mode. That is why we provide hooks to disable those plug-ins when vim-multiple-cursors is active:

For example, if you are using [Neocomplete](, add this to your vimrc to prevent conflict:

function! Multiple_cursors_before() if exists(':NeoCompleteLock')==2 exe 'NeoCompleteLock' endif endfunction function! Multiple_cursors_after() if exists(':NeoCompleteUnlock')==2 exe 'NeoCompleteUnlock' endif endfunction

Plugins themselves can register


 autocommands on 




 for automatic integration.
### Highlight

The plugin uses the highlight group




 to highlight the virtual cursors and their visual selections respectively. You can customize them by putting something similar like the following in your vimrc:

" Default highlighting (see help :highlight and help :highlight-link) highlight multiple_cursors_cursor term=reverse cterm=reverse gui=reverse highlight link multiple_cursors_visual Visual

## FAQ

#### **Q** Pressing <kbd>i</kbd> after selecting words with <kbd>C-n</kbd> makes the plugin hang, why?

**A** When selecting words with <kbd>C-n</kbd>, the plugin behaves like in **visual** mode. Once you pressed <kbd>i</kbd>, you can still press <kbd>I</kbd> to insert text.

#### **Q** <kbd>ALT</kbd>+<kbd>n</kbd> doesn't seem to work in VIM but works in gVIM, why?

**A** This is a well known terminal/Vim [issue](, different terminal have different ways to send


. Try adding this in your 


 and **make sure to replace the string**:

vim if !has('gui_running') map "in Insert mode, type Ctrl+v Alt+n here" endif

Or remap the following:

vim g:multi_cursor_start_key g:multi_cursor_select_all_key

#### **Q** <kbd>CTRL</kbd>+<kbd>n</kbd> doesn't seem to work in gVIM?

**A** Try setting

set selection=inclusive

 in your 


**A** Alternatively, you can just temporarily disable _exclusive_ selection whenever the plugin is active:

VimL augroup MultipleCursorsSelectionFix autocmd User MultipleCursorsPre if &selection ==# 'exclusive' | let g:multi_cursor_save_selection = &selection | set selection=inclusive | endif autocmd User MultipleCursorsPost if exists('g:multi_cursor_save_selection') | let &selection = g:multi_cursor_save_selection | unlet g:multi_cursor_save_selection | endif augroup END

### **Q** deoplete insert giberrish, how to fix this?

**A** use the


 functions, add this in your vimrc:

func! Multiple_cursors_before() if deoplete#is_enabled() call deoplete#disable() let g:deoplete_is_enable_before_multi_cursors = 1 else let g:deoplete_is_enable_before_multi_cursors = 0 endif endfunc func! Multiple_cursors_after() if g:deoplete_is_enable_before_multi_cursors call deoplete#enable() endif endfunc

#### **Q** is it also working on Mac?

**A** On Mac OS, [MacVim]( is known to work.

#### **Q** How can I select 


 keywords with several keystrokes? 


 does not work.

**A** You can use :MultipleCursorsFind keyword. I have this binding in my vimrc:

nnoremap :MultipleCursorsFind / vnoremap :MultipleCursorsFind /

This allows one to search for the keyword using


 and turn search results into cursors with 


## Contributing

Patches and suggestions are always welcome! A list of open feature requests can be found [here](

### Issue Creation

Contributor's time is precious and limited. Please ensure it meets the requirements outlined in [](

### Pull Requests

Running the test suite requires ruby and rake as well as vim of course. Before submitting PR, please ensure the checks are passing:

bash cd vim-multiple-cursors/spec/ bundle exec rake



This is a community supported project. Here is the list of all the Contributors


Obviously inspired by Sublime Text's [multiple selection][sublime-multiple-selection] feature, also encouraged by Emac's [multiple cursors][emacs-multiple-cursors] implementation by Magnar Sveen

[vim-multiple-cursors]: [sublime-multiple-selection]: [Pathogen]: [Vundle]: [Neobundle]: [vim-plug]: [emacs-multiple-cursors]:

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.