diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2019-05-12 21:38:10 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2019-05-12 21:38:10 +1200 |
commit | 7414c6e26a04f2901c131cafc9fb9ebe9b543808 (patch) | |
tree | 7dcdd52bcb9d2ea887c621fcc8ad40135f0d046e | |
parent | Merge branch 'hotfix/v0.1.2' (diff) | |
parent | Bump VERSION (diff) | |
download | vim-regex-escape-7414c6e26a04f2901c131cafc9fb9ebe9b543808.tar.gz vim-regex-escape-7414c6e26a04f2901c131cafc9fb9ebe9b543808.zip |
Merge branch 'release/v0.2.0'v0.2.0
* release/v0.2.0:
Remove unneeded variable scoping
Fix a single-space
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | VERSION | 2 | ||||
-rw-r--r-- | autoload/regex_escape.vim | 14 | ||||
-rw-r--r-- | plugin/regex_escape.vim | 4 |
4 files changed, 11 insertions, 11 deletions
@@ -20,7 +20,7 @@ Becomes: License ------- -Copyright (c) [Tom Ryder][1]. Distributed under the same terms as Vim itself. +Copyright (c) [Tom Ryder][1]. Distributed under the same terms as Vim itself. See `:help license`. [1]: https://sanctum.geek.nz/ @@ -1 +1 @@ -0.1.2 +0.2.0 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 <tom@sanctum.geek.nz> " 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 <expr> <Plug>(RegexEscape) |