aboutsummaryrefslogtreecommitdiff
path: root/vim/autoload/mail.vim
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2019-06-23 01:26:12 +1200
committerTom Ryder <tom@sanctum.geek.nz>2019-06-23 01:26:12 +1200
commit87f5f379d52ffa0a4fb8662788fc28a4a5028dc3 (patch)
tree3d606b1c105a91e7204eed0cddd9ed03f08f9f52 /vim/autoload/mail.vim
parentMerge branch 'release/v6.37.0' (diff)
parentBump VERSION (diff)
downloaddotfiles-87f5f379d52ffa0a4fb8662788fc28a4a5028dc3.tar.gz
dotfiles-87f5f379d52ffa0a4fb8662788fc28a4a5028dc3.zip
Merge branch 'release/v6.38.0'v6.38.0
* release/v6.38.0: Update paste_insert.vim to v0.3.0 Use tr() over substitute() for character swap Fix up some pattern qualifiers Update digraph_search.vim to v1.1.0 Correct indent settings Don't squeeze blanks by default in mail filetype Improve honesty of comment in mail ftplugin Move mail ftplugin function out into autoload Add local maps for normalising mail quotes Don't do :StrictQuote automatically on mail edit Make :StrictQuote command accept a range
Diffstat (limited to 'vim/autoload/mail.vim')
-rw-r--r--vim/autoload/mail.vim23
1 files changed, 23 insertions, 0 deletions
diff --git a/vim/autoload/mail.vim b/vim/autoload/mail.vim
index 40b7fb7f..3fbba860 100644
--- a/vim/autoload/mail.vim
+++ b/vim/autoload/mail.vim
@@ -79,3 +79,26 @@ function! mail#NewBlank(count, up, visual) abort
endif
endfunction
+
+function! mail#StrictQuote(start, end) abort
+ let body = 0
+ for lnum in range(a:start, a:end)
+
+ " Get current line
+ let line = getline(lnum)
+
+ " Get the leading quote string, if any; skip if there isn't one
+ let quote = matchstr(line, '^>[> ]*')
+ if !strlen(quote)
+ continue
+ endif
+
+ " Normalise the quote with no spaces
+ let quote = substitute(quote, '[^>]', '', 'g')
+
+ " Re-set the line
+ let line = substitute(line, '^[> ]\+', quote, '')
+ call setline(lnum, line)
+
+ endfor
+endfunction