Skip to content

Commit

Permalink
Visual mode mappings
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewRadev committed Nov 24, 2012
1 parent c154bcf commit 0411017
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 5 additions & 1 deletion autoload/whitespaste.vim
@@ -1,4 +1,8 @@
function! whitespaste#Paste(normal_command) function! whitespaste#Paste(normal_command, visual)
if a:visual
normal! gv
endif

if getregtype() == 'V' if getregtype() == 'V'
call whitespaste#PasteLinewise(a:normal_command) call whitespaste#PasteLinewise(a:normal_command)
elseif getregtype() == 'v' elseif getregtype() == 'v'
Expand Down
6 changes: 4 additions & 2 deletions plugin/whitespaste.vim
Expand Up @@ -44,11 +44,13 @@ autocmd FileType vim let b:whitespaste_linewise_definitions = {
\ ] \ ]
\ } \ }


command WhitespasteBefore :call whitespaste#Paste('P') command! -count=0 WhitespasteBefore :call whitespaste#Paste('P', <count>)
command WhitespasteAfter :call whitespaste#Paste('p') command! -count=0 WhitespasteAfter :call whitespaste#Paste('p', <count>)


nmap <Plug>WhitespasteBefore :WhitespasteBefore<cr> nmap <Plug>WhitespasteBefore :WhitespasteBefore<cr>
nmap <Plug>WhitespasteAfter :WhitespasteAfter<cr> nmap <Plug>WhitespasteAfter :WhitespasteAfter<cr>
xmap <Plug>WhitespasteBefore :WhitespasteBefore<cr>
xmap <Plug>WhitespasteAfter :WhitespasteAfter<cr>
let &cpo = s:keepcpo let &cpo = s:keepcpo
unlet s:keepcpo unlet s:keepcpo

0 comments on commit 0411017

Please sign in to comment.