aboutsummaryrefslogtreecommitdiff
path: root/plugin/regex_escape.vim
blob: c430bf6aa6ff98dde0e9afb573a9ec9e633443a6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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('loaded_regex_escape') || &compatible
  finish
endif
if v:version < 700
  finish
endif
let loaded_regex_escape = 1

" Set up mapping
nnoremap <expr> <Plug>(RegexEscape)
      \ regex_escape#()
xnoremap <expr> <Plug>(RegexEscape)
      \ regex_escape#()