diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2019-05-24 11:30:11 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2019-05-24 11:30:11 +1200 |
commit | bcb2b0d8b9b394d7ea9d3fad8838e84aa5aa4bae (patch) | |
tree | b8da630390f5e8cbef7ca0dbe18119ef13a8acc8 | |
parent | Merge branch 'release/v4.43.0' (diff) | |
parent | Bump VERSION (diff) | |
download | dotfiles-bcb2b0d8b9b394d7ea9d3fad8838e84aa5aa4bae.tar.gz dotfiles-bcb2b0d8b9b394d7ea9d3fad8838e84aa5aa4bae.zip |
Merge branch 'release/v4.44.0'v4.44.0
* release/v4.44.0:
Bump VERSION
Don't strip tabs after angle quotes
More revision/expansion of blank/greeting strip
Break up and improve greeting pattern
Make greeting regex even nuttier
-rw-r--r-- | VERSION | 4 | ||||
-rw-r--r-- | vim/after/ftplugin/mail.vim | 37 |
2 files changed, 24 insertions, 17 deletions
@@ -1,2 +1,2 @@ -tejr dotfiles v4.43.0 -Thu May 23 22:16:48 UTC 2019 +tejr dotfiles v4.44.0 +Thu May 23 23:30:11 UTC 2019 diff --git a/vim/after/ftplugin/mail.vim b/vim/after/ftplugin/mail.vim index fd2c9705..47c82bb6 100644 --- a/vim/after/ftplugin/mail.vim +++ b/vim/after/ftplugin/mail.vim @@ -10,22 +10,29 @@ if line('.') == 1 && col('.') == 1 " no quote, which is fine call search('\m^>', 'c') - " Delete quoted blank lines until we get to something with substance - while getline('.') =~# '^>\s*$' + " Delete quoted blank lines or quoted greetings until we get to something + " with substance. Yes, I like Perl, how could you tell? + while getline('.') =~? '^> *' + \ . '\%(' + \ . '\%(' + \ . 'g''\=day' + \ . '\|\%(good \)\=\%(morning\|afternoon\|evening\)' + \ . '\|h[eu]\%(ll\|rr\)o\+' + \ . '\|hey\+' + \ . '\|hi\+' + \ . '\|sup' + \ . '\|what''s up' + \ . '\|yo' + \ . '\)' + \ . '[[:punct:] ]*' + \ . '\%(' + \ . '\a\+' + \ . '[[:punct:] ]*' + \ . '\)\=' + \ . '\)\=$' delete endwhile - " Check this line to see if it's a generic hello or hello-name greeting that - " we can just strip out; delete any following lines too, if they're blank - if getline('.') =~? '^>\s*\%(<hello\|hey\+\|hi\)\%(\s\+\S\+\)\=[,;]*\s*$' - delete - - " Delete quoted blank lines again - while getline('.') =~# '^>\s*$' - delete - endwhile - endif - " Now move to the first quoted or unquoted blank line call search('\m^>\=$', 'c') @@ -38,7 +45,7 @@ for lnum in range(1, line('$')) let line = getline(lnum) " Get the leading quote string, if any; stop if there isn't one - let quote = matchstr(line, '^[> \t]\+') + let quote = matchstr(line, '^[> ]\+') if strlen(quote) == 0 continue endif @@ -47,7 +54,7 @@ for lnum in range(1, line('$')) let quote = substitute(quote, '[^>]', '', 'g') " Re-set the line - let line = substitute(line, '^[> \t]\+', quote, '') + let line = substitute(line, '^[> ]\+', quote, '') call setline(lnum, line) endfor |