aboutsummaryrefslogtreecommitdiff
path: root/vim/after/ftplugin/mail.vim
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-07-14 01:16:10 +1200
committerTom Ryder <tom@sanctum.geek.nz>2018-07-14 01:16:10 +1200
commit7c7e86850b43d8e990c005b0bc80e684c3ea341b (patch)
tree2ed560acd9edb40132d2822341885eb6af7157e9 /vim/after/ftplugin/mail.vim
parentMerge branch 'release/v1.27.0' (diff)
parentBump VERSION (diff)
downloaddotfiles-7c7e86850b43d8e990c005b0bc80e684c3ea341b.tar.gz
dotfiles-7c7e86850b43d8e990c005b0bc80e684c3ea341b.zip
Merge branch 'release/v1.28.0'v1.28.0
* release/v1.28.0: Bump VERSION Upgrade diff_prune.vim ftplugin Replace mail.vim quoting mappings Upgrade put_blank_lines.vim plugin Remove :nohlsearch from vimrc Move to after headers when writing new mail Rename and refine reload_vimrc_filetype.vim Remove visual mode space/backspace remap Move .vimrc reloading stuff into custom plugin Add missing angle bracket for Vim ftplugin undo Remove bell disabling in Vim Simplify 'shortmess' settings Disable 'spellcapcheck' for README.md files Check for 'spell' feature in ftplugins Add ftplugin for tmux
Diffstat (limited to 'vim/after/ftplugin/mail.vim')
-rw-r--r--vim/after/ftplugin/mail.vim23
1 files changed, 22 insertions, 1 deletions
diff --git a/vim/after/ftplugin/mail.vim b/vim/after/ftplugin/mail.vim
index 3ecc0310..d22ec142 100644
--- a/vim/after/ftplugin/mail.vim
+++ b/vim/after/ftplugin/mail.vim
@@ -1,8 +1,29 @@
" Extra configuration for mail messages
-if &filetype !=# 'mail' || v:version < 700
+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 line('.') == 1 && col('.') == 1
+ call search('^$', 'c')
+endif
+
" Add a space to the end of wrapped lines for format-flowed mail
setlocal formatoptions+=w
let b:undo_ftplugin .= '|setlocal formatoptions<'
+
+" Stop here if the user doesn't want ftplugin mappings
+if exists('g:no_plugin_maps') || exists('g:no_mail_maps')
+ finish
+endif
+
+" The quote mapping in the stock plugin is a good idea, but I prefer it to
+" work as a motion rather than quoting to the end of the buffer
+nnoremap <buffer> <expr> <LocalLeader>q mail#Quote()
+nnoremap <buffer> <expr> <LocalLeader>qq mail#Quote().'_'
+xnoremap <buffer> <expr> <LocalLeader>q mail#Quote()
+let b:undo_ftplugin .= '|nunmap <LocalLeader>q'
+ \ . '|nunmap <LocalLeader>qq'
+ \ . '|xunmap <LocalLeader>q'