From 582790977cdbb98c0ab9bfdd8d9e1cabfe79ac0d Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 12 May 2019 23:32:12 +1200 Subject: Remove unneeded variable scoping --- autoload/squeeze_repeat_blanks.vim | 24 ++++++++++++------------ plugin/squeeze_repeat_blanks.vim | 4 ++-- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/autoload/squeeze_repeat_blanks.vim b/autoload/squeeze_repeat_blanks.vim index 1429fcf..1b760b4 100644 --- a/autoload/squeeze_repeat_blanks.vim +++ b/autoload/squeeze_repeat_blanks.vim @@ -3,40 +3,40 @@ function! squeeze_repeat_blanks#Squeeze(start, end) abort " List of line numbers to delete - let l:deletions = [] + let deletions = [] " Flag for whether we've encountered a blank line group - let l:group = 0 + let group = 0 " Pattern for what constitutes a 'blank'; configurable per-buffer - let l:pattern = get(b:, 'squeeze_repeat_blanks_blank', '^$') + let pattern = get(b:, 'squeeze_repeat_blanks_blank', '^$') " Iterate through the lines, collecting numbers to delete - for l:num in range(a:start, a:end) + for num in range(a:start, a:end) " End a blank group if the current line doesn't match the pattern - if getline(l:num) !~# l:pattern - let l:group = 0 + if getline(num) !~# pattern + let group = 0 " If we've found a repeated blank line, flag the one before it for " deletion; this way we end up with the last line of the group - elseif l:group - let l:deletions += [l:num - 1] + elseif group + let deletions += [num - 1] " If this is the first blank line, start a group else - let l:group = 1 + let group = 1 endif endfor " Delete each flagged line, in reverse order so that renumbering doesn't " bite us - for l:num in reverse(l:deletions) - silent execute l:num . 'delete' + for num in reverse(deletions) + silent execute num . 'delete' endfor " Report how many lines were deleted - echomsg len(l:deletions) . ' deleted' + echomsg len(deletions) . ' deleted' endfunction diff --git a/plugin/squeeze_repeat_blanks.vim b/plugin/squeeze_repeat_blanks.vim index e0391c3..fb85812 100644 --- a/plugin/squeeze_repeat_blanks.vim +++ b/plugin/squeeze_repeat_blanks.vim @@ -6,13 +6,13 @@ " Author: Tom Ryder " License: Same as Vim itself " -if exists('g:loaded_squeeze_repeat_blanks') || &compatible +if exists('loaded_squeeze_repeat_blanks') || &compatible finish endif if !has('user_commands') || v:version < 700 finish endif -let g:loaded_squeeze_repeat_blanks = 1 +let loaded_squeeze_repeat_blanks = 1 " User command for the above command! -range=% SqueezeRepeatBlanks -- cgit v1.2.3