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
6 "setlocal formatoptions+=aw
11 "augroup tsperrorinsert
17 " Dynamically set format options, depending on where you are in a
18 " mail, idea from Teemu Likonen:
19 " http://groups.google.com/group/vim_use/msg/f59e5c1adc6be2b3
22 let s:defaults = 'setlocal tw=68 ts=2 sts=2 sw=2 fo='.d_fo
24 let b:MailAreaDetect=1
26 "nnoremap <buffer> <LocalLeader>ma1 :call <SID>MailAreaDetect_On()
27 " \ <bar> echo 'MailAreaDetect On'<CR>
28 "nnoremap <buffer> <LocalLeader>ma0 :call <SID>MailAreaDetect_Off()
29 " \ <bar> echo 'MailAreaDetect Off'<CR>
31 nnoremap <buffer><silent> <F9> :call <SID>MailAreaDetect_Switch(0)<CR>
32 inoremap <buffer><silent> <F9> <C-\><C-O>:call <SID>MailAreaDetect_Switch(1)<CR>
34 function! s:MailAreaDetect_Switch(vmode)
36 silent call <SID>MailAreaDetect_Off()
37 let b:MailAreaDetect=0
38 echo 'MailAreaDetect Off'
43 silent call <SID>MailAreaDetect_On()
44 let b:MailAreaDetect=1
45 echo 'MailAreaDetect On'
53 function! s:MailAreaDetect_On()
54 silent autocmd! MailAreaDetect CursorMoved,CursorMoved
55 \ <buffer> call <SID>AreaOptions()
56 let b:MailAreaDetect=1
59 function! s:MailAreaDetect_Off()
60 silent autocmd! MailAreaDetect
62 let b:MailAreaDetect=0
65 augroup MailAreaDetect
67 call <SID>MailAreaDetect_On()
70 function! s:AreaOptions()
72 if <SID>CheckArea('\v^From( |: ).*\n','\v^$')
74 setlocal fo-=a fo-=w fo-=t sts=0 sw=2 noet
75 elseif getline('.') =~ '\m^\s*>'
78 elseif <SID>CheckArea('\m^--- .*\n^+++ ','\v(^$|\n^-- $)')
80 setlocal fo-=a fo-=w fo-=t sts=0 sw=2 noet
81 elseif <SID>CheckArea('^-- $','^$')
83 setlocal fo-=a fo-=w fo-=t sts=0 sw=2 noet
90 function! s:CheckArea(start, end)
91 return (search(a:start,'bcnW')-line('.')) >
92 \ (search(a:end,'bnW')-line('.'))
95 augroup tsperrorinsert