From 486b4be06f6de1209fff5a2017a1fd665979a7e0 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 12 May 2019 23:31:31 +1200 Subject: Switch to two-spacing --- README.md | 2 +- doc/squeeze_repeat_blanks.txt | 8 ++++---- plugin/squeeze_repeat_blanks.vim | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 6796209..13e8f06 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ What constitutes a "blank" line is configurable per-buffer. 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/ diff --git a/doc/squeeze_repeat_blanks.txt b/doc/squeeze_repeat_blanks.txt index ab2cca5..0eb4894 100644 --- a/doc/squeeze_repeat_blanks.txt +++ b/doc/squeeze_repeat_blanks.txt @@ -8,22 +8,22 @@ What constitutes a "blank" line is configurable per-buffer. REQUIREMENTS *squeeze_repeat_blanks-requirements* -This plugin is only available if 'compatible' is not set. It also requires the -|+user_commands| feature. +This plugin is only available if 'compatible' is not set. It also requires +the |+user_commands| feature. COMMANDS *squeeze_repeat_blanks-commands* *:SqueezeRepeatBlanks* Find repeated blank lines matching the |b:squeeze_repeat_blanks_blank| pattern and delete all but the last line of every such group, reporting the number of -lines removed. Accepts a range and defaults to the whole buffer. +lines removed. Accepts a range and defaults to the whole buffer. OPTIONS *squeeze_repeat_blanks-options* *b:sequeeze_repeat_blanks_blank* The |buffer-variable| `b:squeeze_repeat_blanks_blank` can be set to a pattern that constitutes a blank line, for example including whitespace, or a comment -or quoting leader. This might be desirable for some filetypes. The +or quoting leader. This might be desirable for some filetypes. The `:SqueezeRepeatBlanks` command defaults to using `^$`, for a true blank line. AUTHOR *squeeze_repeat_blanks-author* diff --git a/plugin/squeeze_repeat_blanks.vim b/plugin/squeeze_repeat_blanks.vim index dcf8b0a..e0391c3 100644 --- a/plugin/squeeze_repeat_blanks.vim +++ b/plugin/squeeze_repeat_blanks.vim @@ -1,6 +1,6 @@ " " squeeze_repeat_blanks.vim: User command to reduce all groups of blank lines -" to the last line in that group, deleting the others. Good for filtering +" to the last line in that group, deleting the others. Good for filtering " plaintext mail that's been extracted from HTML. " " Author: Tom Ryder -- cgit v1.2.3 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 From 679fd1af76afb79dbf842c775cc9296c49e9c41a Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 12 May 2019 23:32:39 +1200 Subject: Bump VERSION --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 17e51c3..0ea3a94 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.1.1 +0.2.0 -- cgit v1.2.3