diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2019-05-23 14:18:09 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2019-05-23 14:18:09 +1200 |
commit | 069cd09edc55fcd9d8ee495d19cdcf3987232cf1 (patch) | |
tree | 4b19a30276e11d8c348dad4dc279de2392844fd0 /vim/after/ftplugin/mail.vim | |
parent | Merge branch 'release/v4.39.0' (diff) | |
parent | Bump VERSION (diff) | |
download | dotfiles-069cd09edc55fcd9d8ee495d19cdcf3987232cf1.tar.gz dotfiles-069cd09edc55fcd9d8ee495d19cdcf3987232cf1.zip |
Merge branch 'release/v4.40.0'v4.40.0
* release/v4.40.0:
Bump VERSION
Improve blank line squeeze behaviour for mail
Don't add a space to trailing quotes
Prevent unneeded capture of group in greet regex
Update vim-squeeze-repeat-bolanks to v0.3.0
Diffstat (limited to 'vim/after/ftplugin/mail.vim')
-rw-r--r-- | vim/after/ftplugin/mail.vim | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/vim/after/ftplugin/mail.vim b/vim/after/ftplugin/mail.vim index 15277f7b..0145f0aa 100644 --- a/vim/after/ftplugin/mail.vim +++ b/vim/after/ftplugin/mail.vim @@ -8,7 +8,7 @@ if line('.') == 1 && col('.') == 1 " 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*$' + if getline('.') =~? '^>\s*\%(<hello\|hey\+\|hi\)\%(\s\+\S\+\)\=[,;]*\s*$' delete while getline('.') =~# '^>\s*$' delete @@ -32,8 +32,8 @@ for lnum in range(1, line('$')) break endif - " Normalise the quote with no intermediate and one trailing space - let quote = substitute(quote, '[^>]', '', 'g').' ' + " Normalise the quote with no spaces + let quote = substitute(quote, '[^>]', '', 'g') " Re-set the line let line = substitute(line, '^[> \t]\+', quote, '') @@ -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 |