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

Updated vim plugins

This commit is contained in:
amix
2013-04-26 13:17:22 -03:00
parent a817e88e35
commit 687184f0bb
45 changed files with 1186 additions and 411 deletions

View File

@ -0,0 +1,2 @@
--color
--format d

View File

@ -0,0 +1,7 @@
language: ruby
rvm:
- 1.9.3
before_install: sudo apt-get install vim-gtk
before_script:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"

View File

@ -0,0 +1,97 @@
## 2.0 (04/24/2013)
Bugfixes:
- Fix inconsistent undo behavior. Changes made in multicursor insert mode are now undone together. This fixes #22.
- Single key commands that do not terminate properly no longer cause ghostly cursors to linger on screen. An error message is now displayed informing the user the number of cursor locations that the input cannot be properly played back at. This fixes #28.
## 1.16 (04/23/2013)
Features:
- Add integration tests using vimrunner. Hook up travis-ci to run continous integration on commit.
## 1.15 (04/22/2013)
Bugfixes:
- Fix plugin causing error bell. This fixes #29.
## 1.14 (04/22/2013)
Features:
- Allow users to separate start key from next key. (credit: @xanderman)
## 1.13 (04/22/2013)
Bugfixes:
- Add support for switching to visual line mode from inside multicursor mode
- Fix highlight issue where extra character at end of line is highlighted for visual selections covering more than 2 lines.
## 1.12 (04/19/2013)
Bugfixes:
- Fix tab character causing highlight errors. This fixes #18 and fixes #32
## 1.11 (04/18/2013)
Bugfixes:
- Fix regression where `C-n` doesn't exhibit correct behavior when all matches have been found
- Clear echo messages when a new input is received
## 1.10 (04/17/2013)
Bugfixes:
- `O` works now in normal mode. This fixes #24
- Turn on `lazyredraw` during multicursor mode to prevent the sluggish screen redraws
Features:
- Add command **MultipleCursorsFind** to add multiple virtual cursors using regexp. This closes #20
## 1.9 (04/17/2013)
Bugfixes:
- Fix starting multicursor mode in visual line mode. This fixes #25
- Major refactoring to avoid getting in and out of visual mode as much as possible
## 1.8 (04/16/2013)
Bugfixes:
- Fix regression that causes call stack to explode with too many cursors
## 1.7 (04/15/2013)
Bugfixes:
- Finally fix the annoying highlighting problem when the last virtual cursor is on the last character of the line. The solution is a hack, but it should be harmless
## 1.6 (04/15/2013)
Bugfixes:
- Stop chaining dictionary function calls. This fixes #10 and #11
## 1.5 (04/15/2013)
Bugfixes:
- Exit Vim's visual mode before waiting for user's next input. This fixes #14
## 1.4 (04/14/2013)
Bugfixes:
- Don't use clearmatches(). It clears highlighting from other plugins. This fixes #13
## 1.3 (04/14/2013)
Bugfixes:
- Change mapping from using expression-quote syntax to using raw strings
## 1.2 (04/14/2013)
Bugfixes:
- Restore view when exiting from multicursor mode. This fixes #5
- Remove the unnecessary user level mapping for 'prev' and 'skip' in visual mode, since we can purely detect those keys from multicursor mode
## 1.1 (04/14/2013)
Bugfixes:
- Stop hijacking escape key in normal mode. This fixes #1, #2, and #3
## 1.0 (04/13/2013)
Initial release

View File

@ -0,0 +1,4 @@
source 'https://rubygems.org'
gem 'vimrunner'
gem 'rake'
gem 'rspec'

View File

@ -0,0 +1,22 @@
GEM
remote: https://rubygems.org/
specs:
diff-lcs (1.2.4)
rake (10.0.4)
rspec (2.13.0)
rspec-core (~> 2.13.0)
rspec-expectations (~> 2.13.0)
rspec-mocks (~> 2.13.0)
rspec-core (2.13.1)
rspec-expectations (2.13.0)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.13.1)
vimrunner (0.3.0)
PLATFORMS
ruby
DEPENDENCIES
rake
rspec
vimrunner

View File

49
sources_non_forked/vim-multiple-cursors/README.md Executable file → Normal file
View File

@ -1,4 +1,4 @@
# vim-multiple-cursors
# vim-multiple-cursors [![Build Status](https://travis-ci.org/terryma/vim-multiple-cursors.png)](https://travis-ci.org/terryma/vim-multiple-cursors)
## About
[There](https://github.com/paradigm/vim-multicursor) [have](https://github.com/felixr/vim-multiedit) [been](https://github.com/hlissner/vim-multiedit) [many](https://github.com/adinapoli/vim-markmultiple) [attempts](https://github.com/AndrewRadev/multichange.vim) 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.
@ -12,6 +12,11 @@
### Do it backwards too! This is not just a replay of the above gif :)
![Example3](assets/example3.gif?raw=true)
### Add multiple cursors using regexes
![Example4](assets/example4.gif?raw=true)
To see what keystrokes are used for the above example, see [this issue](https://github.com/terryma/vim-multiple-cursors/issues/39).
## Features
- Live update in Insert mode
- One key to rule it all! See [Quick Start](#quick-start) on what the key does in different scenarios
@ -31,31 +36,45 @@ 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.
You can also add multiple cursors using a regular expression. The command `MultipleCursorsFind` accepts a range and a pattern, and it will create a virtual cursor at the end of every match within the range. If no range is passed in, then it defaults to the entire buffer.
**NOTE:** 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.
## Mapping
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
Out of the box, only the single key `Ctrl-n` is mapped in regular Vim's Normal mode and Visual mode to provide the functionality mentioned above. `Ctrl-n`, `Ctrl-p`, `Ctrl-x`, and `<Esc>` are mapped in the special multicursor mode once you've added at least one virtual cursor to the buffer. If you don't like the plugin taking over your favorite key bindings, you can turn off the default with
```
let g:multi_cursor_use_default_mapping=0
```
You can map the 'next', 'previous', 'skip', and 'exit' keys like the following:
You can then 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>"
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_quit_key='<Esc>'
```
By default, the 'next' key is also used to enter multicursor mode. If you want to use a different key to start multicursor mode than for selecting the next location, do like the following:
```
" Map start key separately from next key
let g:multi_cursor_start_key='<F6>'
```
**IMPORTANT:** Please note that currently only single keystrokes and special keys can be mapped. This contraint is also the reason why multikey commands such as `ciw` do not work and cause unexpected behavior in Normal mode. This means that a mapping like `<Leader>n` will NOT work correctly. For a list of special keys that are supported, see `help :key-notation`
**NOTE:** Please make sure to always map something to `g:multi_cursor_quit_key`, otherwise you'll have a tough time quitting from multicursor mode.
**NOTE:** Prior to version 1.3, the recommended way to map the keys is using the expressoin quote syntax in Vim, using something like `"\<C-n>"` or `"\<Esc>"` (see h: expr-quote). After 1.3, the recommended way is to use a raw string like above. If your key mappings don't appear to work, give the new syntax a try.
## Setting
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.
If set to 0, then pressing `g:multi_cursor_quit_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.
If set to 0, then pressing `g:multi_cursor_quit_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.
### Highlight
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:
@ -69,15 +88,14 @@ highlight link multiple_cursors_visual Visual
## 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
## Changelog
See [CHANGELOG.md](CHANGELOG.md)
## Contributing
As one can see, there're still many issues to be resolved, patches and suggestions are always welcome!
As one can see, there're still many issues to be resolved, patches and suggestions are always welcome! A list of open feature requests can be found [here](../../issues?labels=enhancement&state=open).
## Credit
Obviously inspired by Sublime Text's [multiple selection][sublime-multiple-selection] feature, also encouraged by Emac's [multiple cursors][emacs-multiple-cursors] implemetation by Magnar Sveen
@ -88,3 +106,4 @@ Obviously inspired by Sublime Text's [multiple selection][sublime-multiple-selec
[Vundle]:http://github.com/gmarik/vundle
[Neobundle]:http://github.com/Shougo/neobundle.vim
[emacs-multiple-cursors]:https://github.com/magnars/multiple-cursors.el

View File

@ -0,0 +1,5 @@
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
task :default => :spec

View File

Before

Width:  |  Height:  |  Size: 101 KiB

After

Width:  |  Height:  |  Size: 101 KiB

View File

Before

Width:  |  Height:  |  Size: 265 KiB

After

Width:  |  Height:  |  Size: 265 KiB

View File

Before

Width:  |  Height:  |  Size: 182 KiB

After

Width:  |  Height:  |  Size: 182 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 532 KiB

File diff suppressed because it is too large Load Diff

View File

@ -61,36 +61,68 @@ 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.
You can also add multiple cursors using a regular expression. The command
*MultipleCursorsFind* accepts a range and a pattern, and it will create a
virtual cursor at the end of every match within the range. If no range is
passed in, then it defaults to the entire buffer.
NOTE: 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 >
Out of the box, only the single key CTRL-N is mapped in regular Vim's Normal
mode and Visual mode to provide the functionality mentioned above. CTRL-N,
CTRL-P, CTRL-X, and <ESC> are mapped in the special multicursor mode once
you've added at least one virtual cursor to the buffer. If you don't like the
plugin taking over your favorite key bindings, you can 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>")
*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_quit_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>"
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_quit_key='<Esc>'
<
*g:multi_cursor_start_key* (Default: 'g:multi_cursor_next_key')
By default, the same key is used to enter multicursor mode as to select the
next cursor location. If you want to use a different key to start multicursor
mode than for selecting the next location, do like the following: >
" Map start key separately from next key
let g:multi_cursor_start_key='<F6>'
<
IMPORTANT: Please note that currently only single keystroes and special
keys can be mapped. This contraint is also the reason why multikey commands
such as `ciw` do not work and cause unexpected behavior in Normal mode. This
means that a mapping like `<Leader>n` will NOT work correctly. For a list of
special keys that are supported, see |key-notation|
NOTE: Please make sure to always map something to |g:multi_cursor_quit_key|,
otherwise you'll have a tough time quitting from multicursor mode.
NOTE: Prior to version 1.3, the recommended way to map the keys is using the
expressoin quote syntax in Vim, using something like `"\<C-n>"` or `"\<Esc>"`
(see h: expr-quote). After 1.3, the recommended way is to use a raw string
like above. If your key mappings don't appear to work, give the new syntax a
try.
==============================================================================
4. Global Options *multiple-cursors-global-options*
@ -98,14 +130,14 @@ 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
If set to 0, then pressing |g:multi_cursor_quit_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
If set to 0, then pressing |g:multi_cursor_quit_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.
@ -128,15 +160,8 @@ like the following in your vimrc: >
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*

View File

@ -1,9 +1,11 @@
MultipleCursorsFind multiple_cursors.txt /*MultipleCursorsFind*
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_quit_key multiple_cursors.txt /*g:multi_cursor_quit_key*
g:multi_cursor_skip_key multiple_cursors.txt /*g:multi_cursor_skip_key*
g:multi_cursor_start_key multiple_cursors.txt /*g:multi_cursor_start_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*

View File

@ -2,45 +2,11 @@
" File: multiple_cursors.vim
" Author: Terry Ma
" Description: Emulate Sublime Text's multi selection feature
" Issues:
" - Performance in terminal vim degrades significantly with more cursors
" - 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.
" - Multi key commands is not supported
" - 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
" - Select mode is not implemented
" - There is a bug with selection and highlight when wrap is on
"
" Potential Features:
" - Create a blinking cursor effect? Good place to do it would be instead of
" waiting for user input, cycle through the highlight
" - Integrate with the status line? Maybe show a special multicursor mode?
" - Support mouse? Ctrl/Cmd click to set cursor?
"
" Features:
" - Real time update of cursor locations
" - In normal mode, pressing <C-n> will highlight the current word under cursor,
" and places a 'multicursor' at the end of the word, and goes to visual mode
" - In visual mode, right after the above operation, pressing <C-n> again will
" search for the word forward, and places a new cursor at the end of the
" resulting search, one can continue to do this in Visual mode, this resembles
" the Cmd-D feature of Sublime
" - In insert mode, insert operations are captures and replayed at all the
" cursor locations
" - Pressing <Esc> in Normal mode quits multicursor mode and clears all cursors
" - Normal mode single keystroke commands work:
" - Works: 'w,e,i,p,a,h,j,k,l,x,v,b'
" - Does not work: ''
" - Replace mode just seems to work
" - Visual mode
" - Works: 'w,e,b,h,j,k,l,o'
" - Does not work: 'A, I', because <C-o> does not get it out of normal mode
" for these commands. It takes two
"===============================================================================
let s:save_cpo = &cpo
set cpo&vim
@ -67,10 +33,10 @@ let s:settings = {
\ }
let s:settings_if_default = {
\ 'quit_key': "\<Esc>",
\ 'next_key': "\<C-n>",
\ 'prev_key': "\<C-p>",
\ 'skip_key': "\<C-x>",
\ 'quit_key': '<Esc>',
\ 'next_key': '<C-n>',
\ 'prev_key': '<C-p>',
\ 'skip_key': '<C-x>',
\ }
call s:init_settings(s:settings)
@ -79,21 +45,21 @@ if g:multi_cursor_use_default_mapping
call s:init_settings(s:settings_if_default)
endif
if !exists('g:multi_cursor_start_key') && exists('g:multi_cursor_next_key')
let g:multi_cursor_start_key = g:multi_cursor_next_key
endif
" External mappings
if exists('g:multi_cursor_next_key')
exec 'nnoremap <silent> '.g:multi_cursor_next_key.
if exists('g:multi_cursor_start_key')
exec 'nnoremap <silent> '.g:multi_cursor_start_key.
\' :call multiple_cursors#new("n")<CR>'
exec 'xnoremap <silent> '.g:multi_cursor_next_key.
exec 'xnoremap <silent> '.g:multi_cursor_start_key.
\' :<C-u>call multiple_cursors#new("v")<CR>'
endif
if exists('g:multi_cursor_prev_key')
exec 'xnoremap <silent> '.g:multi_cursor_prev_key.
\' :<C-u>call multiple_cursors#prev()<CR>'
endif
if exists('g:multi_cursor_skip_key')
exec 'xnoremap <silent> '.g:multi_cursor_skip_key.
\' :<C-u>call multiple_cursors#skip()<CR>'
endif
" Commands
command! -nargs=1 -range=% MultipleCursorsFind
\ call multiple_cursors#find(<line1>, <line2>, <q-args>)
let &cpo = s:save_cpo
unlet s:save_cpo

View File

@ -0,0 +1,259 @@
require 'spec_helper'
def set_file_content(string)
string = normalize_string_indent(string)
File.open(filename, 'w'){ |f| f.write(string) }
vim.edit filename
end
def get_file_content()
vim.write
IO.read(filename).strip
end
def before(string)
set_file_content(string)
end
def after(string)
get_file_content().should eq normalize_string_indent(string)
end
def type(string)
string.scan(/<.*?>|./).each do |key|
if /<.*>/.match(key)
vim.feedkeys "\\#{key}"
else
vim.feedkeys key
end
end
end
describe "Multiple Cursors" do
let(:filename) { 'test.txt' }
specify "#multiline replacement" do
before <<-EOF
hello
hello
hello
EOF
type '<C-n><C-n><C-n>cworld<Esc>'
after <<-EOF
world
world
world
EOF
end
specify "#single line replacement" do
before <<-EOF
hello hello hello
EOF
type '<C-n><C-n><C-n>cworld<Esc>'
after <<-EOF
world world world
EOF
end
specify "#mixed line replacement" do
before <<-EOF
hello hello
hello
EOF
type '<C-n><C-n><C-n>cworld<Esc>'
after <<-EOF
world world
world
EOF
end
specify "#new line in insert mode" do
before <<-EOF
hello
hello
EOF
type '<C-n><C-n>chello<CR>world<Esc>'
after <<-EOF
hello
world
hello
world
EOF
end
specify "#new line in insert mode middle of line" do
before <<-EOF
hello world
hello world
EOF
type '<C-n><C-n>vlxi<cr><Esc>'
after <<-EOF
hello
world
hello
world
EOF
end
specify "#normal mode 'o'" do
before <<-EOF
hello
hello
EOF
type '<C-n><C-n>voworld<Esc>'
after <<-EOF
hello
world
hello
world
EOF
end
specify "#normal mode 'O'" do
before <<-EOF
hello
hello
EOF
type '<C-n><C-n>vOworld<Esc>'
after <<-EOF
world
hello
world
hello
EOF
end
specify "#find command basic" do
before <<-EOF
hello
hello
EOF
vim.normal ':MultipleCursorsFind hello<CR>'
type 'cworld<Esc>'
after <<-EOF
world
world
EOF
end
specify "#visual line mode replacement" do
before <<-EOF
hello world
hello world
EOF
type '<C-n><C-n>Vchi!<Esc>'
after <<-EOF
hi!
hi!
EOF
end
specify "#skip key" do
before <<-EOF
hello
hello
hello
EOF
type '<C-n><C-n><C-x>cworld<Esc>'
after <<-EOF
world
hello
world
EOF
end
specify "#prev key" do
before <<-EOF
hello
hello
hello
EOF
type '<C-n><C-n><C-n><C-p>cworld<Esc>'
after <<-EOF
world
world
hello
EOF
end
specify "#normal mode 'I'" do
before <<-EOF
hello
hello
EOF
type '<C-n><C-n>vIworld <Esc>'
after <<-EOF
world hello
world hello
EOF
end
specify "#normal mode 'A'" do
before <<-EOF
hello
hello
EOF
type '<C-n><C-n>vA world<Esc>'
after <<-EOF
hello world
hello world
EOF
end
specify "#undo" do
before <<-EOF
hello
hello
EOF
type '<C-n><C-n>cworld<Esc>u'
after <<-EOF
hello
hello
EOF
end
# 'd' is an operator pending command, which are not supported at the moment.
# This should result in a nop, but we should still remain in multicursor mode.
specify "#normal mode 'd'" do
before <<-EOF
hello
hello
EOF
type '<C-n><C-n>vdx<Esc>'
after <<-EOF
hell
hell
EOF
end
end

View File

@ -0,0 +1,25 @@
require 'vimrunner'
require 'vimrunner/rspec'
Vimrunner::RSpec.configure do |config|
# Use a single Vim instance for the test suite. Set to false to use an
# instance per test (slower, but can be easier to manage).
config.reuse_server = true
# Decide how to start a Vim instance. In this block, an instance should be
# spawned and set up with anything project-specific.
config.start_vim do
# vim = Vimrunner.start
# Or, start a GUI instance:
vim = Vimrunner.start_gvim
# Setup your plugin in the Vim instance
plugin_path = File.expand_path('../..', __FILE__)
vim.add_plugin(plugin_path, 'plugin/multiple_cursors.vim')
# The returned value is the Client available in the tests.
vim
end
end