diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2018-12-29 22:03:42 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2018-12-29 22:03:42 +1300 |
commit | 57608dd23b6be224c74a03f2d27112b9b08f4816 (patch) | |
tree | 8774a13e7d4c1da613fd4a70c2840f52c5aa609a /plugin/regex_escape.vim | |
download | vim-regex-escape-57608dd23b6be224c74a03f2d27112b9b08f4816.tar.gz vim-regex-escape-57608dd23b6be224c74a03f2d27112b9b08f4816.zip |
First versionv0.1.0
Diffstat (limited to 'plugin/regex_escape.vim')
-rw-r--r-- | plugin/regex_escape.vim | 24 |
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() |