aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Rahm <rahm@google.com>2022-08-12 12:36:24 -0600
committerJosh Rahm <rahm@google.com>2022-08-12 12:37:22 -0600
commitb42a2885d77c0cc84c90fe32507eefbc22423cd0 (patch)
tree90002f19739da3b9e9f17abf08b3e4fde9d8762c
parent487a0e61303523ee108beb9eea4c276cd11388ec (diff)
downloadfieldmarshal.vim-b42a2885d77c0cc84c90fe32507eefbc22423cd0.tar.gz
fieldmarshal.vim-b42a2885d77c0cc84c90fe32507eefbc22423cd0.tar.bz2
fieldmarshal.vim-b42a2885d77c0cc84c90fe32507eefbc22423cd0.zip
Add substitute.vim
-rw-r--r--plugin/substitute.vim7
1 files changed, 7 insertions, 0 deletions
diff --git a/plugin/substitute.vim b/plugin/substitute.vim
new file mode 100644
index 0000000..2c08310
--- /dev/null
+++ b/plugin/substitute.vim
@@ -0,0 +1,7 @@
+" C-s in normal mode will replace all the occurences of the last register with
+" what was typed in the provided body.
+noremap <C-s> :set operatorfunc=DoSubstitution<cr>g@
+
+function DoSubstitution(str) abort
+ exec printf(":'[,']s/%s/%s/g", @", @.)
+endfunction