aboutsummaryrefslogtreecommitdiff
path: root/plugin/regex_escape.vim
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/regex_escape.vim')
-rw-r--r--plugin/regex_escape.vim24
1 files changed, 24 insertions, 0 deletions
diff --git a/plugin/regex_escape.vim b/plugin/regex_escape.vim
new file mode 100644
index 0000000..fb11932
--- /dev/null
+++ b/plugin/regex_escape.vim
@@ -0,0 +1,24 @@
+"
+" regex_escape.vim: Operator to escape regular expression metacharacters to
+" make them literal, appropriate to a configurable flavor of regular
+" expression, so that:
+" foo * ^bar $\ baz \ quux
+" becomes:
+" foo \* \^bar \$\\ baz \\ quux
+"
+" Author: Tom Ryder <tom@sanctum.geek.nz>
+" License: Same as Vim itself
+"
+if exists('g:loaded_regex_escape') || &compatible
+ finish
+endif
+if v:version < 700
+ finish
+endif
+let g:loaded_regex_escape = 1
+
+" Set up mapping
+nnoremap <expr> <Plug>(RegexEscape)
+ \ regex_escape#Map()
+xnoremap <expr> <Plug>(RegexEscape)
+ \ regex_escape#Map()