Permalink
Browse files

Visual mode mappings

  • Loading branch information...
AndrewRadev committed Nov 24, 2012
1 parent c154bcf commit 04110174038436b8876a7856ad80213295c5feb9
Showing with 9 additions and 3 deletions.
  1. +5 −1 autoload/whitespaste.vim
  2. +4 −2 plugin/whitespaste.vim
View
@@ -1,4 +1,8 @@
-function! whitespaste#Paste(normal_command)
+function! whitespaste#Paste(normal_command, visual)
+ if a:visual
+ normal! gv
+ endif
+
if getregtype() == 'V'
call whitespaste#PasteLinewise(a:normal_command)
elseif getregtype() == 'v'
View
@@ -44,11 +44,13 @@ autocmd FileType vim let b:whitespaste_linewise_definitions = {
\ ]
\ }
-command WhitespasteBefore :call whitespaste#Paste('P')
-command WhitespasteAfter :call whitespaste#Paste('p')
+command! -count=0 WhitespasteBefore :call whitespaste#Paste('P', <count>)
+command! -count=0 WhitespasteAfter :call whitespaste#Paste('p', <count>)
nmap <Plug>WhitespasteBefore :WhitespasteBefore<cr>
nmap <Plug>WhitespasteAfter :WhitespasteAfter<cr>
+xmap <Plug>WhitespasteBefore :WhitespasteBefore<cr>
+xmap <Plug>WhitespasteAfter :WhitespasteAfter<cr>
let &cpo = s:keepcpo
unlet s:keepcpo

0 comments on commit 0411017

Please sign in to comment.