path: root/vim/after/ftplugin
diff options
authorTom Ryder <tom@sanctum.geek.nz>2019-05-23 14:17:20 +1200
committerTom Ryder <tom@sanctum.geek.nz>2019-05-23 14:17:20 +1200
commit20fec5586193eee65ad090f014c144691401060c (patch)
tree7df6b9ae94ad90ff7a4befd5ac253363bbf043e1 /vim/after/ftplugin
parentDon't add a space to trailing quotes (diff)
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.
Diffstat (limited to 'vim/after/ftplugin')
1 files changed, 10 insertions, 3 deletions
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
" Stop here if the user doesn't want ftplugin mappings