aboutsummaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-08-22 22:16:07 +1200
committerTom Ryder <tom@sanctum.geek.nz>2018-08-22 22:16:07 +1200
commit172fbc5f7e346c26c3cc64335de1e33347f79058 (patch)
treeca708bc0a32651ee3d400e819fbcd21dd30247f9 /plugin
downloadvim-replace-operator-172fbc5f7e346c26c3cc64335de1e33347f79058.tar.gz
vim-replace-operator-172fbc5f7e346c26c3cc64335de1e33347f79058.zip
First versionv0.1.0
Diffstat (limited to 'plugin')
-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>