aboutsummaryrefslogtreecommitdiff
path: root/plugin/regex_escape.vim
blob: fb1193282bdb2bb133477152c9aaed787c78b169 (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('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()