From d711ee84713221f20f3d1e6d50d4e240b24c94ef Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Fri, 24 May 2019 11:29:44 +1200 Subject: More revision/expansion of blank/greeting strip --- vim/after/ftplugin/mail.vim | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) (limited to 'vim') 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') -- cgit v1.2.3