Skip to content

Commit

Permalink
Specs for visual mode
Browse files Browse the repository at this point in the history
Unfortunately, something's not quite right with visual mode. Need to
investigate.
  • Loading branch information
AndrewRadev committed Dec 1, 2012
1 parent 9cf253d commit 885335e
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 3 deletions.
6 changes: 3 additions & 3 deletions plugin/whitespaste.vim
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ autocmd FileType vim let b:whitespaste_linewise_definitions = {
\ ] \ ]
\ } \ }


command! WhitespasteBefore :call whitespaste#Paste(g:whitespaste_paste_before_command) command! WhitespasteBefore call whitespaste#Paste(g:whitespaste_paste_before_command)
command! WhitespasteAfter :call whitespaste#Paste(g:whitespaste_paste_after_command) command! WhitespasteAfter call whitespaste#Paste(g:whitespaste_paste_after_command)
command! -range WhitespasteVisual :call whitespaste#Paste(g:whitespaste_paste_visual_command) command! -range WhitespasteVisual call whitespaste#Paste(g:whitespaste_paste_visual_command)


nmap <Plug>WhitespasteBefore :WhitespasteBefore<cr> nmap <Plug>WhitespasteBefore :WhitespasteBefore<cr>
nmap <Plug>WhitespasteAfter :WhitespasteAfter<cr> nmap <Plug>WhitespasteAfter :WhitespasteAfter<cr>
Expand Down
25 changes: 25 additions & 0 deletions spec/plugin/visual_mode_spec.rb
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,25 @@
require 'spec_helper'

describe "Visual mode" do
let(:filename) { 'test.txt' }
let(:vim) { @vim }

xit "compresses multiple blank lines" do
set_file_contents <<-EOF
one
two
EOF

vim.normal 'V2jy'
vim.search 'two'
vim.whitespaste_visual

assert_file_contents <<-EOF
one
one
EOF
end
end
6 changes: 6 additions & 0 deletions spec/support/vim.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ def vim.whitespaste_after
write write
self self
end end

def vim.whitespaste_visual
normal 'V:WhitespasteVisual<cr>'
write
self
end
end end
end end
end end

0 comments on commit 885335e

Please sign in to comment.