diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2019-06-22 18:52:56 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2019-06-22 18:52:56 +1200 |
commit | 1c77e5f1b0746d4d6e8ca46e8faa7b6cdbf38b2e (patch) | |
tree | c833ca322a6e0f7630f027d34ca3befdbf59490a /vim/after | |
parent | Merge branch 'release/v6.37.0' into develop (diff) | |
download | dotfiles-1c77e5f1b0746d4d6e8ca46e8faa7b6cdbf38b2e.tar.gz dotfiles-1c77e5f1b0746d4d6e8ca46e8faa7b6cdbf38b2e.zip |
Make :StrictQuote command accept a range
Diffstat (limited to 'vim/after')
-rw-r--r-- | vim/after/ftplugin/mail.vim | 14 |
1 files changed, 4 insertions, 10 deletions
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(<q-line1>, <q-line2>) let b:undo_ftplugin .= '|delcommand StrictQuote' StrictQuote |