From 43e2766622132d55bb2a63d44129c419ee215e99 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 6 Aug 2018 09:39:16 +1200 Subject: Make cursor start heuristics for mail smarter Move immediately below the first thing we might want to reply to --- vim/after/ftplugin/mail.vim | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/vim/after/ftplugin/mail.vim b/vim/after/ftplugin/mail.vim index 34c524e1..16c228cd 100644 --- a/vim/after/ftplugin/mail.vim +++ b/vim/after/ftplugin/mail.vim @@ -3,11 +3,17 @@ if &filetype !=# 'mail' || &compatible || v:version < 700 finish endif -" We will almost always want to start editing after the headers, so move to -" the first entirely blank line, if something hasn't already moved us from the -" start of the file +" If something hasn't already moved the cursor, we'll move to an optimal point +" to start writing if line('.') == 1 && col('.') == 1 - 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') + + " Now move to the first quoted or unquoted blank line + call search('\m^>\=$', 'c') + endif " Add a space to the end of wrapped lines for format-flowed mail -- cgit v1.2.3