From 1c77e5f1b0746d4d6e8ca46e8faa7b6cdbf38b2e Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 22 Jun 2019 18:52:56 +1200 Subject: Make :StrictQuote command accept a range --- vim/after/ftplugin/mail.vim | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'vim') diff --git a/vim/after/ftplugin/mail.vim b/vim/after/ftplugin/mail.vim index f4a4c91d..1cc3fd14 100644 --- a/vim/after/ftplugin/mail.vim +++ b/vim/after/ftplugin/mail.vim @@ -49,19 +49,13 @@ let b:undo_ftplugin .= '|delcommand SuggestStart' SuggestStart " Normalise quoting -function! s:StrictQuote() abort +function! s:StrictQuote(start, end) abort let body = 0 - for lnum in range(1, line('$')) + for lnum in range(a:start, a:end) " Get current line let line = getline(lnum) - " Skip lines until we hit a blank line, meaning body text - let body = body || !strlen(line) - if !body - continue - endif - " Get the leading quote string, if any; skip if there isn't one let quote = matchstr(line, '^>[> ]*') if !strlen(quote) @@ -77,8 +71,8 @@ function! s:StrictQuote() abort endfor endfunction -command -bar -buffer StrictQuote - \ call s:StrictQuote() +command -buffer -bar -range=% StrictQuote + \ call s:StrictQuote(, ) let b:undo_ftplugin .= '|delcommand StrictQuote' StrictQuote -- cgit v1.2.3