All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
2 setlocal formatoptions-=o
3 setlocal formatoptions-=r
7 " Dynamically set format options, depending on where you are in a
8 " mail, idea from Teemu Likonen:
9 " http://groups.google.com/group/vim_use/msg/f59e5c1adc6be2b3
12 let s:defaults = 'setlocal tw=68 ts=2 sts=2 sw=2 fo='.d_fo
14 let b:MailAreaDetect=1
16 "nnoremap <buffer> <LocalLeader>ma1 :call <SID>MailAreaDetect_On()
17 " \ <bar> echo 'MailAreaDetect On'<CR>
18 "nnoremap <buffer> <LocalLeader>ma0 :call <SID>MailAreaDetect_Off()
19 " \ <bar> echo 'MailAreaDetect Off'<CR>
21 nnoremap <buffer><silent> <F9> :call <SID>MailAreaDetect_Switch(0)<CR>
22 inoremap <buffer><silent> <F9> <C-\><C-O>:call <SID>MailAreaDetect_Switch(1)<CR>
24 function! s:MailAreaDetect_Switch(vmode)
26 silent call <SID>MailAreaDetect_Off()
27 let b:MailAreaDetect=0
28 echo 'MailAreaDetect Off'
33 silent call <SID>MailAreaDetect_On()
34 let b:MailAreaDetect=1
35 echo 'MailAreaDetect On'
43 function! s:MailAreaDetect_On()
44 silent autocmd! MailAreaDetect CursorMoved,CursorMoved
45 \ <buffer> call <SID>AreaOptions()
46 let b:MailAreaDetect=1
49 function! s:MailAreaDetect_Off()
50 silent autocmd! MailAreaDetect
52 let b:MailAreaDetect=0
55 augroup MailAreaDetect
57 call <SID>MailAreaDetect_On()
60 function! s:AreaOptions()
62 if <SID>CheckArea('\v^From( |: ).*\n','\v^$')
64 setlocal fo-=a fo-=w fo-=t sts=0 sw=2 noet
65 elseif getline('.') =~ '\m^\s*>'
68 elseif <SID>CheckArea('\m^--- .*\n^+++ ','\v(^$|\n^-- $)')
70 setlocal fo-=a fo-=w fo-=t sts=0 sw=2 noet
71 elseif <SID>CheckArea('^-- $','^$')
73 setlocal fo-=a fo-=w fo-=t sts=0 sw=2 noet
80 function! s:CheckArea(start, end)
81 return (search(a:start,'bcnW')-line('.')) >
82 \ (search(a:end,'bnW')-line('.'))