Before Width: | Height: | Size: 753 KiB After Width: | Height: | Size: 753 KiB |
@ -0,0 +1,2 @@ |
||||
--color |
||||
--format d |
@ -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" |
@ -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 |
@ -0,0 +1,4 @@ |
||||
source 'https://rubygems.org' |
||||
gem 'vimrunner' |
||||
gem 'rake' |
||||
gem 'rspec' |
@ -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 |
@ -0,0 +1,5 @@ |
||||
require 'rspec/core/rake_task' |
||||
|
||||
RSpec::Core::RakeTask.new(:spec) |
||||
|
||||
task :default => :spec |
Before Width: | Height: | Size: 101 KiB After Width: | Height: | Size: 101 KiB |
Before Width: | Height: | Size: 265 KiB After Width: | Height: | Size: 265 KiB |
Before Width: | Height: | Size: 182 KiB After Width: | Height: | Size: 182 KiB |
After Width: | Height: | Size: 532 KiB |
@ -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 |
@ -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 |
@ -1,54 +1,51 @@ |
||||
" These are the mappings for snipMate.vim. Putting it here ensures that it |
||||
" will be mapped after other plugins such as supertab.vim. |
||||
if !exists('loaded_snips') || exists('s:did_snips_mappings') |
||||
finish |
||||
endif |
||||
let s:did_snips_mappings = 1 |
||||
" save and reset 'cpo' |
||||
" snipMate maps |
||||
" These maps are created here in order to make sure we can reliably create maps |
||||
" after SuperTab. |
||||
|
||||
let s:save_cpo = &cpo |
||||
set cpo&vim |
||||
|
||||
" This is put here in the 'after' directory in order for snipMate to override |
||||
" other plugin mappings (e.g., supertab). |
||||
" |
||||
" To adjust the tirgger key see (:h snipMate-trigger) |
||||
" |
||||
if !exists('g:snips_trigger_key') |
||||
let g:snips_trigger_key = '<tab>' |
||||
function! s:map_if_not_mapped(lhs, rhs, mode) |
||||
let l:unique = s:overwrite ? '' : ' <unique>' |
||||
if !hasmapto(a:rhs, a:mode) |
||||
silent! exe a:mode . 'map' . l:unique a:lhs a:rhs |
||||
endif |
||||
endfunction |
||||
|
||||
if !exists('g:snips_no_mappings') || !g:snips_no_mappings |
||||
if exists('g:snips_trigger_key') |
||||
echom 'g:snips_trigger_key is deprecated. See :h snipMate-mappings' |
||||
exec 'imap <unique>' g:snips_trigger_key '<Plug>snipMateTrigger' |
||||
exec 'smap <unique>' g:snips_trigger_key '<Plug>snipMateSNext' |
||||
exec 'xmap <unique>' g:snips_trigger_key '<Plug>snipMateVisual' |
||||
else |
||||
" Remove SuperTab map if it exists |
||||
let s:overwrite = maparg('<Tab>', 'i') ==? '<Plug>SuperTabForward' |
||||
call s:map_if_not_mapped('<Tab>', '<Plug>snipMateNextOrTrigger', 'i') |
||||
call s:map_if_not_mapped('<Tab>', '<Plug>snipMateNextOrTrigger', 's') |
||||
let s:overwrite = 0 |
||||
call s:map_if_not_mapped('<Tab>', '<Plug>snipMateVisual', 'x') |
||||
endif |
||||
|
||||
if exists('g:snips_trigger_key_backwards') |
||||
echom 'g:snips_trigger_key_backwards is deprecated. See :h snipMate-mappings' |
||||
exec 'imap <unique>' g:snips_trigger_key_backwards '<Plug>snipMateIBack' |
||||
exec 'smap <unique>' g:snips_trigger_key_backwards '<Plug>snipMateSBack' |
||||
else |
||||
let s:overwrite = maparg('<S-Tab>', 'i') ==? '<Plug>SuperTabBackward' |
||||
call s:map_if_not_mapped('<S-Tab>', '<Plug>snipMateBack', 'i') |
||||
call s:map_if_not_mapped('<S-Tab>', '<Plug>snipMateBack', 's') |
||||
let s:overwrite = 0 |
||||
endif |
||||
|
||||
call s:map_if_not_mapped('<C-R><Tab>', '<Plug>snipMateShow', 'i') |
||||
endif |
||||
|
||||
if !exists('g:snips_trigger_key_backwards') |
||||
let g:snips_trigger_key_backwards = '<s-' . substitute(g:snips_trigger_key, '[<>]', '', 'g') . '>' |
||||
endif |
||||
|
||||
exec 'ino <silent> ' . g:snips_trigger_key . ' <c-r>=snipMate#TriggerSnippet()<cr>' |
||||
exec 'snor <silent> ' . g:snips_trigger_key . ' <esc>i<right><c-r>=snipMate#TriggerSnippet()<cr>' |
||||
exec 'ino <silent> ' . g:snips_trigger_key_backwards . ' <c-r>=snipMate#BackwardsSnippet()<cr>' |
||||
exec 'snor <silent> ' . g:snips_trigger_key_backwards . ' <esc>i<right><c-r>=snipMate#BackwardsSnippet()<cr>' |
||||
exec 'ino <silent> <c-r>' . g:snips_trigger_key . ' <c-r>=snipMate#ShowAvailableSnips()<cr>' |
||||
|
||||
" maybe there is a better way without polluting registers ? |
||||
exec 'xnoremap ' . g:snips_trigger_key. ' s<c-o>:let<space>g:snipmate_content_visual=getreg('1')<cr>' |
||||
|
||||
" The default mappings for these are annoying & sometimes break snipMate. |
||||
" You can change them back if you want, I've put them here for convenience. |
||||
snor <bs> b<bs> |
||||
snor <right> <esc>a |
||||
snor <left> <esc>bi |
||||
snor ' b<bs>' |
||||
snor ` b<bs>` |
||||
snor % b<bs>% |
||||
snor U b<bs>U |
||||
snor ^ b<bs>^ |
||||
snor \ b<bs>\ |
||||
snor <c-x> b<bs><c-x> |
||||
|
||||
" By default load snippets in snippets_dir |
||||
if empty(snippets_dir) |
||||
finish |
||||
endif |
||||
" FIXME: Without this map, <BS> in select mode deletes the current selection and |
||||
" returns to normal mode. This doesn't update placeholders. Ideally there's some |
||||
" way to update the placeholders without this otherwise useless map. |
||||
silent! snoremap <unique> <BS> b<BS><Esc> |
||||
|
||||
" restore 'cpo' |
||||
let &cpo = s:save_cpo |
||||
|
||||
" vim:noet:sw=4:ts=4:ft=vim |
||||
" vim:noet: |
||||
|