aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-08-06 09:39:16 +1200
committerTom Ryder <tom@sanctum.geek.nz>2018-08-06 09:39:16 +1200
commit43e2766622132d55bb2a63d44129c419ee215e99 (patch)
tree7d177c450ef2d2b502b1c0d40e00007d40ba386e
parent9c05d0aaa8b3d95d6defd05aa1c352e28be43c01 (diff)
downloaddotfiles-43e2766622132d55bb2a63d44129c419ee215e99.tar.gz
dotfiles-43e2766622132d55bb2a63d44129c419ee215e99.zip
Make cursor start heuristics for mail smarter
Move immediately below the first thing we might want to reply to
-rw-r--r--vim/after/ftplugin/mail.vim14
1 files 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