diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2019-12-30 20:23:43 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2019-12-30 20:23:43 +1300 |
commit | 78b3b3e49b8dc8286a3059e4b3a5bc11214c9a5d (patch) | |
tree | 32ff337ee16af906b36b4c4a1928bad4a809839e /vim/after/ftplugin/mail.vim | |
parent | Specify encoding of file with ZALGO comment (diff) | |
download | dotfiles-78b3b3e49b8dc8286a3059e4b3a5bc11214c9a5d.tar.gz dotfiles-78b3b3e49b8dc8286a3059e4b3a5bc11214c9a5d.zip |
Move ft=mail start suggestion to autoload
Diffstat (limited to 'vim/after/ftplugin/mail.vim')
-rw-r--r-- | vim/after/ftplugin/mail.vim | 41 |
1 files changed, 1 insertions, 40 deletions
diff --git a/vim/after/ftplugin/mail.vim b/vim/after/ftplugin/mail.vim index 9f8fc608..200234c6 100644 --- a/vim/after/ftplugin/mail.vim +++ b/vim/after/ftplugin/mail.vim @@ -3,47 +3,8 @@ let b:quote_space = 0 let b:undo_ftplugin .= '|unlet b:quote_space' -" Attempt to move to a good spot to start writing -function! s:SuggestStart() abort - - " Move to top of buffer - call setpos('.', [0, 1, 1, 0]) - - " Move to body text - call search('\m^$', 'c') | + - - " Start by trying to move to the first quoted line; this may fail if there's - " no quote, which is fine - call search('\m^>', 'c') - - " 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[''\u2019]\=day' - \ . '\|\%(good \)\=\%(morning\|afternoon\|evening\)' - \ . '\|h[eu]\%(ll\|rr\)o\+' - \ . '\|hey\+' - \ . '\|hi\+' - \ . '\|sup' - \ . '\|what[''\u2019]\=s up' - \ . '\|yo' - \ . '\)' - \ . '[[:punct:] ]*' - \ . '\%(' - \ . '\a\+' - \ . '[[:punct:] ]*' - \ . '\)\=' - \ . '\)\=$' - delete - endwhile - - " Now move to the first quoted or unquoted blank line - call search('\m^>\= *$', 'c') -endfunction command! -bar -buffer SuggestStart - \ call s:SuggestStart() + \ call mail#SuggestStart() let b:undo_ftplugin .= '|delcommand SuggestStart' SuggestStart |