From 1627350eb8da7b8a80a11b53145c25a61318064b Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 12 May 2019 21:37:44 +1200 Subject: Remove unneeded variable scoping --- autoload/regex_escape.vim | 14 +++++++------- plugin/regex_escape.vim | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/autoload/regex_escape.vim b/autoload/regex_escape.vim index 380f48b..6acff6b 100644 --- a/autoload/regex_escape.vim +++ b/autoload/regex_escape.vim @@ -14,7 +14,7 @@ function! regex_escape#Operatorfunc(type) abort " Save the current value of the unnamed register and the current value of " the 'clipboard' and 'selection' options into a dictionary for restoring " after this is all done - let l:save = { + let save = { \ 'register': @@, \ 'clipboard': &clipboard, \ 'selection': &selection @@ -39,15 +39,15 @@ function! regex_escape#Operatorfunc(type) abort " Determine the regex flavor to use; if one is defined for the buffer, use " that; failing that, if one is defined globally in g:regex_escape_flavor, " use that; failing that, just use 'bre' - let l:flavor = get(b:, 'regex_escape_flavor', + let flavor = get(b:, 'regex_escape_flavor', \ get(g:, 'regex_escape_flavor', 'bre')) " Get the corresponding character class - let l:class = s:classes[l:flavor] + let class = s:classes[flavor] " Perform the substitution on the unnamed register's contents, inserting a " backslash before every instance of any character in that class - let @@ = substitute(@@, l:class, '\\&', 'g') + let @@ = substitute(@@, class, '\\&', 'g') " Paste our substituted changes back in over the top of the previously " selected text, by reselecting it before the paste @@ -55,9 +55,9 @@ function! regex_escape#Operatorfunc(type) abort " Restore contents of the unnamed register and the previous values of the " 'clipboard' and 'selection' options. - let @@ = l:save['register'] - let &clipboard = l:save['clipboard'] - let &selection = l:save['selection'] + let @@ = save['register'] + let &clipboard = save['clipboard'] + let &selection = save['selection'] endfunction diff --git a/plugin/regex_escape.vim b/plugin/regex_escape.vim index fb11932..5a44e51 100644 --- a/plugin/regex_escape.vim +++ b/plugin/regex_escape.vim @@ -9,13 +9,13 @@ " Author: Tom Ryder " License: Same as Vim itself " -if exists('g:loaded_regex_escape') || &compatible +if exists('loaded_regex_escape') || &compatible finish endif if v:version < 700 finish endif -let g:loaded_regex_escape = 1 +let loaded_regex_escape = 1 " Set up mapping nnoremap (RegexEscape) -- cgit v1.2.3