Permalink
Browse files

Override p and P

  • Loading branch information...
1 parent 885335e commit 1f070955b8d3a1ddb6082ebc0579d02f49c248ae @AndrewRadev committed Dec 5, 2012
Showing with 22 additions and 3 deletions.
  1. +19 −0 plugin/whitespaste.vim
  2. +3 −3 spec/support/vim.rb
View
@@ -18,6 +18,14 @@ if !exists('g:whitespaste_paste_visual_command')
let g:whitespaste_paste_visual_command = 'normal! gvp'
endif
+if !exists('g:whitespaste_before_mapping')
+ let g:whitespaste_before_mapping = 'P'
+endif
+
+if !exists('g:whitespaste_after_mapping')
+ let g:whitespaste_after_mapping = 'p'
+endif
+
if !exists('g:whitespaste_linewise_definitions')
let g:whitespaste_linewise_definitions = {
\ 'top': [
@@ -64,5 +72,16 @@ nmap <Plug>WhitespasteBefore :WhitespasteBefore<cr>
nmap <Plug>WhitespasteAfter :WhitespasteAfter<cr>
xmap <Plug>WhitespasteVisual :WhitespasteVisual<cr>
+
+if g:whitespaste_before_mapping != ''
+ exe 'nmap ' . g:whitespaste_before_mapping . ' <Plug>WhitespasteBefore'
+ exe 'xmap ' . g:whitespaste_before_mapping . ' <Plug>WhitespasteVisual'
+endif
+
+if g:whitespaste_after_mapping != ''
+ exe 'nmap ' . g:whitespaste_after_mapping . ' <Plug>WhitespasteAfter'
+ exe 'xmap ' . g:whitespaste_after_mapping . ' <Plug>WhitespasteVisual'
+endif
+
let &cpo = s:keepcpo
unlet s:keepcpo
View
@@ -2,19 +2,19 @@ module Support
module Vim
def self.define_vim_methods(vim)
def vim.whitespaste_before
- command 'WhitespasteBefore'
+ command 'normal P'
write
self
end
def vim.whitespaste_after
- command 'WhitespasteAfter'
+ command 'normal p'
write
self
end
def vim.whitespaste_visual
- normal 'V:WhitespasteVisual<cr>'
+ command 'normal Vp'
write
self
end

0 comments on commit 1f07095

Please sign in to comment.