aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2019-05-12 23:32:12 +1200
committerTom Ryder <tom@sanctum.geek.nz>2019-05-12 23:32:12 +1200
commit582790977cdbb98c0ab9bfdd8d9e1cabfe79ac0d (patch)
tree1bedc4a1cdbd9a3e68b9ae34dbb557e96d5ccf00
parent486b4be06f6de1209fff5a2017a1fd665979a7e0 (diff)
downloadvim-squeeze-repeat-blanks-582790977cdbb98c0ab9bfdd8d9e1cabfe79ac0d.tar.gz
vim-squeeze-repeat-blanks-582790977cdbb98c0ab9bfdd8d9e1cabfe79ac0d.zip
Remove unneeded variable scoping
-rw-r--r--autoload/squeeze_repeat_blanks.vim24
-rw-r--r--plugin/squeeze_repeat_blanks.vim4
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 <tom@sanctum.geek.nz>
" 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