From 20fec5586193eee65ad090f014c144691401060c Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 23 May 2019 14:17:20 +1200 Subject: Improve blank line squeeze behaviour for mail Don't squeeze blank lines if there are no quote prefixes in the message, suggesting that this is a new message and that we will be wanting to keep the two blank lines between the header and the signature, so that "o" just starts writing a message, like I'm used to. --- vim/after/ftplugin/mail.vim | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'vim/after/ftplugin') diff --git a/vim/after/ftplugin/mail.vim b/vim/after/ftplugin/mail.vim index b91c3542..0145f0aa 100644 --- a/vim/after/ftplugin/mail.vim +++ b/vim/after/ftplugin/mail.vim @@ -45,12 +45,19 @@ endfor setlocal formatoptions+=w let b:undo_ftplugin .= '|setlocal formatoptions<' -" Define what constitutes a 'blank line' for the squeeze_repeat_blanks.vim -" plugin, if loaded, to include leading quotes and spaces, and then do it +" Mail-specific handling for custom vim-squeeze-repeat-blanks plugin if exists('loaded_squeeze_repeat_blanks') + + " Set the blank line pattern let b:squeeze_repeat_blanks_blank = '^[ >]*$' let b:undo_ftplugin .= '|unlet b:squeeze_repeat_blanks_blank' - silent SqueezeRepeatBlanks + + " If there is anything quoted in this message (i.e. it looks like a reply), + " squeeze blanks, but don't report lines deleted + if search('\m^>', 'cnw') + silent SqueezeRepeatBlanks + endif + endif " Stop here if the user doesn't want ftplugin mappings -- cgit v1.2.3