Ⅰ. 插件描述
Multiple cursors plugin for vim/neovimⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'mg979/vim-visual-multi'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'mg979/vim-visual-multi'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'mg979/vim-visual-multi'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/mg979/vim-visual-multi
Ⅳ. 文档说明
## vim-visual-multi
It's called vim-visual-multi in analogy with _visual-block_, but the plugin works mostly from normal mode.
Basic usage:
- select words with Ctrl-N (like
Ctrl-din Sublime Text/VS Code) - create cursors vertically with Ctrl-Down/Ctrl-Up
- select one character at a time with Shift-Arrows
- press n/N to get next/previous occurrence
- press [/] to select next/previous cursor
- press q to skip current and get next occurrence
- press Q to remove current cursor/selection
- start insert mode with i,a,I,A
Two main modes:
- in cursor mode commands work as they would in normal mode
- in extend mode commands work as they would in visual mode
- press Tab to switch between «cursor» and «extend» mode
Most vim commands work as expected (motions, r to replace characters, ~ to change case, etc). Additionally you can:
- run macros/ex/normal commands at cursors
- align cursors
- transpose selections
- add patterns with regex, or from visual mode
And more... of course, you can enter insert mode and autocomplete will work.
Installation
With vim-plug:
Plug "mg979/vim-visual-multi", {'branch': 'master'}
Documentation
:help visual-multi
Tutorial
To run the tutorial:
vim -Nu path/to/visual-multi/tutorialrc
Wiki
The wiki was the first documentation for the plugin, but many pictures are
outdated and contain wrong mappings. Still, you can take a look.
You could read at least the Quick Start.
Some (sometimes very old) random pics:
Insert mode with autocomplete, alignment (mappings in pic have changed, don't trust them)

Undo/Redo edits and selections

Alternate cursor/extend mode, motions (even %), reverse direction (as in visual mode) and extend from the back. At any time you can switch from extend to cursor mode and viceversa.

Select inside/around brackets/quotes/etc:

Select operator, here shown with 'wellle/targets.vim' plugin: sib, sia, saa + selection shift

Single region mode in insert mode, Tab moves to the next cursor

Synched column transposition

Unsynched transposition (cycle all regions, also in different lines)

Shift regions left and right (M-S-<>)

Independent anchoring

Find words under cursor, add new words (patterns stack), navigate regions, skip them, add regions with regex.

Normal/Visual/Ex commands at cursors

Macros. Shorter lines are skipped when adding cursors above/below.

Some editing functions: yank, delete, paste from register, paste block from yanked regions

Case conversion
