]> ruderich.org/simon Gitweb - config/dotfiles.git/blobdiff - vim/vim/after/ftplugin/mail.vim
Move to vim/ in preparation for merge into new dotfiles repository
[config/dotfiles.git] / vim / vim / after / ftplugin / mail.vim
diff --git a/vim/vim/after/ftplugin/mail.vim b/vim/vim/after/ftplugin/mail.vim
new file mode 100644 (file)
index 0000000..8d46f5a
--- /dev/null
@@ -0,0 +1,46 @@
+" Vim filetype plugin file
+"
+" Language:     Mail
+" Maintainer:   Simon Ruderich <simon@ruderich.org>
+" License:      GPL v3+
+
+" Copyright (C) 2009-2013  Simon Ruderich
+"
+" This file is free software: you can redistribute it and/or modify
+" it under the terms of the GNU General Public License as published by
+" the Free Software Foundation, either version 3 of the License, or
+" (at your option) any later version.
+"
+" This file is distributed in the hope that it will be useful,
+" but WITHOUT ANY WARRANTY; without even the implied warranty of
+" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+" GNU General Public License for more details.
+"
+" You should have received a copy of the GNU General Public License
+" along with this file.  If not, see <http://www.gnu.org/licenses/>.
+
+
+" Use only 65 characters per line as given in rfc1855.
+setlocal textwidth=65
+
+" Remove trailing whitespace after quotes.
+silent! %s/^>.\{-}\zs\s\+$//
+" Remove spaces between quotes (> > to >>).
+silent! %s/^>\+\zs >/>/g
+silent! %s/^>\+\zs >/>/g
+silent! %s/^>\+\zs >/>/g
+
+" Move directly after the headers.
+normal! gg
+normal! }
+" And if the mail contains a reply move the cursor after the quote.
+if search('^On .\+ wrote:$', 'n')
+    normal! }
+endif
+
+" Fold quotes. Thanks to Teemu Likonen <tlikonen@iki.fi>
+" (http://permalink.gmane.org/gmane.editors.vim.devel/20890,
+" <20080809190407.GA7584@mithlond.arda.local>) and danielsh_ in #mutt on
+" Freenode (2010-07-10 13:01 CEST) for letting me know.
+setlocal foldmethod=expr foldminlines=2
+setlocal foldexpr=strlen(substitute(substitute(getline(v:lnum),'\\s','','g'),'[^>].*','',''))