diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2019-05-24 11:29:44 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2019-05-24 11:29:44 +1200 |
commit | d711ee84713221f20f3d1e6d50d4e240b24c94ef (patch) | |
tree | 1c1ed08c14ebb2ee88cf259316f382309a12ff8c /vim/after/ftplugin/mail.vim | |
parent | Break up and improve greeting pattern (diff) | |
download | dotfiles-d711ee84713221f20f3d1e6d50d4e240b24c94ef.tar.gz dotfiles-d711ee84713221f20f3d1e6d50d4e240b24c94ef.zip |
More revision/expansion of blank/greeting strip
Diffstat (limited to 'vim/after/ftplugin/mail.vim')
-rw-r--r-- | vim/after/ftplugin/mail.vim | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/vim/after/ftplugin/mail.vim b/vim/after/ftplugin/mail.vim index 8a8e82fc..b14bb859 100644 --- a/vim/after/ftplugin/mail.vim +++ b/vim/after/ftplugin/mail.vim @@ -10,26 +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 greeting that we can just strip - " out; delete any following lines too, if they're blank - if getline('.') =~? '^> *' - \ . '\%(h[eu]llo\+\|hey\+\|hi\+\|sup\|what''s up' - \ . '\|\%(good \)\=\%(morning\|afternoon\|evening\)\)' - \ . '\%( \a\+\)\=' - \ . '[[:punct:]]* *$' - 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') |