aboutsummaryrefslogtreecommitdiff
path: root/plugin/regex_escape.vim
blob: b70d8e14ec847bb31b866cd61d4b95b75ca01e27 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
"
" 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 || 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#()