From 574091de5d163db749f3c9e118e0ae864313bc50 Mon Sep 17 00:00:00 2001 From: othree Date: Fri, 23 Jan 2015 13:27:47 +0800 Subject: [PATCH] Add option `g:eregex_force_case` --- plugin/eregex.vim | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/plugin/eregex.vim b/plugin/eregex.vim index 5fdcb11..329103a 100644 --- a/plugin/eregex.vim +++ b/plugin/eregex.vim @@ -295,6 +295,12 @@ if !exists('g:eregex_backward_delim') let g:eregex_backward_delim = '?' endif +"v262 +if !exists('g:eregex_force_case') + let g:eregex_force_case = 0 +endif + + let s:enable = 0 function! eregex#toggle(...) @@ -742,6 +748,12 @@ function! s:Ematch(...) let offset = substitute(offset, '\C[' . s:str_modifiers . ']\+', "", "g") endif + if g:eregex_force_case == 1 + if match(modifiers, 'i') == -1 && match(modifiers, 'I') == -1 + let modifiers .= 'I' + endif + endif + let regex = s:ExtendedRegex2VimRegex(regex, modifiers) "v130 "set s:bakregex @@ -803,6 +815,12 @@ function! s:Esubstitute(...) range let options = substitute(options, '\C[SCDmM]', "", "g") endif + if g:eregex_force_case == 1 + if match(modifiers, 'i') == -1 && match(modifiers, 'I') == -1 + let modifiers .= 'I' + endif + endif + let regex = s:ExtendedRegex2VimRegex(regex, modifiers) "v130 "set s:bakregex