aboutsummaryrefslogtreecommitdiff
path: root/plugin/replace_operator.vim
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/replace_operator.vim')
-rw-r--r--plugin/replace_operator.vim22
1 files changed, 22 insertions, 0 deletions
diff --git a/plugin/replace_operator.vim b/plugin/replace_operator.vim
new file mode 100644
index 0000000..3e048d8
--- /dev/null
+++ b/plugin/replace_operator.vim
@@ -0,0 +1,22 @@
+"
+" replace_operator.vim: Replace text selected with a motion with the
+" contents of a register in a repeatable way.
+"
+" Author: Tom Ryder <tom@sanctum.geek.nz>
+" License: Same as Vim itself
+"
+if exists('g:loaded_replace_operator') || &compatible
+ finish
+endif
+if v:version < 700
+ finish
+endif
+let g:loaded_replace_operator = 1
+
+" Set up mapping
+nnoremap <silent> <unique>
+ \ <Plug>(ReplaceOperator)
+ \ :<C-U>set operatorfunc=replace_operator#Operatorfunc<CR>g@
+xnoremap <silent> <unique>
+ \ <Plug>(ReplaceOperator)
+ \ :<C-U>call replace_operator#Operatorfunc(visualmode())<CR>