]> ruderich.org/simon Gitweb - config/dotfiles.git/blob - vim/vim/after/ftplugin/mail.vim
Merge branch 'multimedia' again
[config/dotfiles.git] / vim / vim / after / ftplugin / mail.vim
1 " Vim filetype plugin file
2 "
3 " Language:     Mail
4 " Maintainer:   Simon Ruderich <simon@ruderich.org>
5 " License:      GPL v3+
6
7 " Copyright (C) 2009-2013  Simon Ruderich
8 "
9 " This file is free software: you can redistribute it and/or modify
10 " it under the terms of the GNU General Public License as published by
11 " the Free Software Foundation, either version 3 of the License, or
12 " (at your option) any later version.
13 "
14 " This file is distributed in the hope that it will be useful,
15 " but WITHOUT ANY WARRANTY; without even the implied warranty of
16 " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 " GNU General Public License for more details.
18 "
19 " You should have received a copy of the GNU General Public License
20 " along with this file.  If not, see <http://www.gnu.org/licenses/>.
21
22
23 " Use only 65 characters per line as given in rfc1855.
24 setlocal textwidth=65
25
26 " Remove trailing whitespace after quotes.
27 silent! %s/^>.\{-}\zs\s\+$//
28 " Remove spaces between quotes (> > to >>).
29 silent! %s/^>\+\zs >/>/g
30 silent! %s/^>\+\zs >/>/g
31 silent! %s/^>\+\zs >/>/g
32
33 " Move directly after the headers.
34 normal! gg
35 normal! }
36 " And if the mail contains a reply move the cursor after the quote.
37 if search('^On .\+ wrote:$', 'n')
38     normal! }
39 endif
40
41 " Fold quotes. Thanks to Teemu Likonen <tlikonen@iki.fi>
42 " (http://permalink.gmane.org/gmane.editors.vim.devel/20890,
43 " <20080809190407.GA7584@mithlond.arda.local>) and danielsh_ in #mutt on
44 " Freenode (2010-07-10 13:01 CEST) for letting me know.
45 setlocal foldmethod=expr foldminlines=2
46 setlocal foldexpr=strlen(substitute(substitute(getline(v:lnum),'\\s','','g'),'[^>].*','',''))