1
0
mirror of https://github.com/amix/vimrc synced 2025-06-16 01:25:00 +08:00

Added two new plugins: vim-expand-region and vim-multiple-cursors.

They are both super useful. Read more on their GitHub pages for more info:
https://github.com/terryma/vim-expand-region
https://github.com/terryma/vim-multiple-cursors
This commit is contained in:
amix
2013-04-14 12:48:31 -03:00
parent c1bacbbc80
commit 8b5bc388b0
19 changed files with 1743 additions and 1 deletions

View File

@ -0,0 +1,174 @@
*vim-multiple-cursors.txt* True Sublime Text multiple selection in Vim
____ _ __
____ ___ __ __/ / /_(_)___ / /__ _______ ________________ __________
/ __ `__ \/ / / / / __/ / __ \/ / _ \ / ___/ / / / ___/ ___/ __ \/ ___/ ___/
/ / / / / / /_/ / / /_/ / /_/ / / __/ / /__/ /_/ / / (__ ) /_/ / / (__ )
/_/ /_/ /_/\__,_/_/\__/_/ .___/_/\___/ \___/\__,_/_/ /____/\____/_/ /____/
/_/
Reference Manual~
==============================================================================
CONTENTS *multiple-cursors-contents*
1.Intro...................................|multiple-cursors-intro|
2.Usage...................................|multiple-cursors-usage|
3.Mappings................................|multiple-cursors-mappings|
4.Global Options..........................|multiple-cursors-global-options|
5.Issues..................................|multiple-cursors-issues|
6.Contributing............................|multiple-cursors-contributing|
7.License.................................|multiple-cursors-license|
8.Credit..................................|multiple-cursors-credit|
9.References..............................|multiple-cursors-references|
==============================================================================
1. Intro *multiple-cursors-intro*
There [1] have [2] been [3] many [4] attempts [5] at bringing Sublime Text's
awesome multiple selection [6] 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.
==============================================================================
2. Usage *multiple-cursors-usage*
Out of the box, all you need to know is a single key CTRL-N. Pressing the key
in Normal mode highlights the current word under the cursor in Visual mode and
places a virtual cursor at the end of it. Pressing it again finds the next
ocurrence and places another virtual cursor at the end of the visual
selection. If you select multiple lines in Visual mode, pressing the key puts
a virtual cursor at every line and leaves you in Normal mode.
After you've marked all your locations with CTRL-N, you can change the visual
selection with normal Vim motion commands in Visual mode. You could go to
Normal mode by pressing v and wield your motion commands there. Single key
command to switch to Insert mode such as `c` or `s` from Visual mode or `i`,
`a`, `I`, `A` in Normal mode should work without any issues.
At any time, you can press <Esc> to exit back to regular Vim.
Two additional keys are also mapped:
CTRL-P in Visual mode will remove the current virtual cursor and go back to
the previous virtual cursor location. This is useful if you are trigger happy
with Ctrl-n and accidentally went too far.
CTRL-X in Visual mode will remove the current virtual cursor and skip to the
next virtual cursor location. This is useful if you don't want the current
selection to be a candidate to operate on later.
**NOTE**: The plugin is still somewhat buggy, if at any time you have
lingering cursors on screen, you can press CTRL-N in Normal mode and it will
remove all prior cursors before starting a new one.
==============================================================================
3. Mappings *multiple-cursors-mappings*
*g:multi_cursor_use_default_mapping* (Default: 1)
Out of the box, CTRL-N, CTRL-P, and CTRL-X are mapped by default. If you don't
like the plugin taking over your favorite key bindings, then turn off the
default with >
let g:multi_cursor_use_default_mapping=0
<
*g:multi_cursor_next_key* (Default: "\<C-n>")
*g:multi_cursor_prev_key* (Default: "\<C-p>")
*g:multi_cursor_skip_key* (Default: "\<C-x>")
*g:multi_cursor_exit_key* (Default: "\<Esc>")
You can map the 'next', 'previous', 'skip', and 'exit' keys like the
following: >
" Default mapping
let g:multi_cursor_next_key="\<C-n>"
let g:multi_cursor_prev_key="\<C-p>"
let g:multi_cursor_skip_key="\<C-x>"
let g:multi_cursor_exit_key="\<Esc>"
<
==============================================================================
4. Global Options *multiple-cursors-global-options*
Currently there're two additional global settings one can tweak:
*g:multi_cursor_exit_from_visual_mode* (Defaut: 1)
If set to 0, then pressing |g:multi_cursor_exit_key| in Visual mode will not
quit and delete all existing cursors. This is useful if you want to press
Escape and go back to Normal mode, and still be able to operate on all the
cursors.
*g:multi_cursor_exit_from_insert_mode* (Default: 1)
If set to 0, then pressing |g:multi_cursor_exit_key| in Insert mode will not
quit and delete all existing cursors. This is useful if you want to press
Escape and go back to Normal mode, and still be able to operate on all the
cursors.
The plugin uses the highlight group `multiple_cursors_cursor` and
`multiple_cursors_visual` 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
<
==============================================================================
5. Issues *multiple-cursors-issues*
- Multi key commands like ciw do not work at the moment
- All user input typed before Vim is able to fan out the last operation to all
cursors is lost. This is a implementation decision to keep the input
perfectly synced in all locations, at the cost of potentially losing user
input.
- Single key commands that do not terminate properly cause unexpected
behavior. For example, if the cursor is on the first character in the buffer
and 'b' is pressed.
- Undo behavior is unpredictable
- Performance in terminal vim degrades significantly with more cursors
- Select mode is not implemented
- Buggy when wrap is turned on
- Cursor highlighting is off. The last column on the same row as Vim's cursor
is not highlighted incorrectly. Setting virtualedit=all might help
==============================================================================
6. Contributing *multiple-cursors-contributing*
The project is hosted on Github. Patches, feature requests and suggestions are
always welcome!
Find the latest version of the plugin here:
http://github.com/terryma/vim-multiple-cursors
==============================================================================
7. License *multiple-cursors-license*
The project is licensed under the MIT license [7]. Copyrigth 2013 Terry Ma
==============================================================================
8. Credit *multiple-cursors-credit*
The plugin is obviously inspired by Sublime Text's awesome multiple selection
[6] feature. Some inspiration was also taken from Emac's multiple cursors [8]
implementation.
==============================================================================
9. References *multiple-cursors-references*
[1] https://github.com/paradigm/vim-multicursor
[2] https://github.com/felixr/vim-multiedit
[3] https://github.com/hlissner/vim-multiedit
[4] https://github.com/adinapoli/vim-markmultiple
[5] https://github.com/AndrewRadev/multichange.vim
[6] http://www.sublimetext.com/docs/2/multiple_selection_with_the_keyboard.html
[7] http://opensource.org/licenses/MIT
[8] https://github.com/magnars/multiple-cursors.el
vim:tw=78:sw=4:ft=help:norl:

View File

@ -0,0 +1,19 @@
g:multi_cursor_exit_from_insert_mode multiple_cursors.txt /*g:multi_cursor_exit_from_insert_mode*
g:multi_cursor_exit_from_visual_mode multiple_cursors.txt /*g:multi_cursor_exit_from_visual_mode*
g:multi_cursor_exit_key multiple_cursors.txt /*g:multi_cursor_exit_key*
g:multi_cursor_next_key multiple_cursors.txt /*g:multi_cursor_next_key*
g:multi_cursor_prev_key multiple_cursors.txt /*g:multi_cursor_prev_key*
g:multi_cursor_skip_key multiple_cursors.txt /*g:multi_cursor_skip_key*
g:multi_cursor_use_default_mapping multiple_cursors.txt /*g:multi_cursor_use_default_mapping*
multiple-cursors-contents multiple_cursors.txt /*multiple-cursors-contents*
multiple-cursors-contributing multiple_cursors.txt /*multiple-cursors-contributing*
multiple-cursors-credit multiple_cursors.txt /*multiple-cursors-credit*
multiple-cursors-global-options multiple_cursors.txt /*multiple-cursors-global-options*
multiple-cursors-intro multiple_cursors.txt /*multiple-cursors-intro*
multiple-cursors-issues multiple_cursors.txt /*multiple-cursors-issues*
multiple-cursors-license multiple_cursors.txt /*multiple-cursors-license*
multiple-cursors-mappings multiple_cursors.txt /*multiple-cursors-mappings*
multiple-cursors-references multiple_cursors.txt /*multiple-cursors-references*
multiple-cursors-usage multiple_cursors.txt /*multiple-cursors-usage*
vim-multiple-cursors multiple_cursors.txt /*vim-multiple-cursors*
vim-multiple-cursors.txt multiple_cursors.txt /*vim-multiple-cursors.txt*