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
104 nmap <buffer> <C-P><F1> :w<CR>:%!mailplate --keep-unknown official<CR>
105 nmap <buffer> <C-P><F2> :w<CR>:%!mailplate --keep-unknown tahi<CR>
106 nmap <buffer> <C-P><F3> :w<CR>:%!mailplate --keep-unknown pmvm<CR>
107 nmap <buffer> <C-P><F4> :w<CR>:%!mailplate --keep-unknown pobox<CR>
108 nmap <buffer> <C-P><F5> :w<CR>:%!mailplate --keep-unknown debian<CR>
109 nmap <buffer> <C-P><F6> :w<CR>:%!mailplate --keep-unknown debconf<CR>
110 nmap <buffer> <C-P><F7> :w<CR>:%!mailplate --keep-unknown uniwh<CR>
111 nmap <buffer> <C-P><F8> :w<CR>:%!mailplate --keep-unknown mtfk<CR>
112 nmap <buffer> <C-P><F9> :w<CR>:%!mailplate --keep-unknown sudetia<CR>
113 nmap <buffer> <C-P><F12> :w<CR>:%!mailplate --keep-unknown private<CR>
114 nmap <buffer> <F1> :w<CR>:%!mailplate --auto --keep-unknown 2>/dev/null<CR>
116 " change subject line
117 " Before: Subject: old
118 " After : Subject: New (was: old)
119 " http://strcat.de/wiki/dotfiles#vim
120 " map ,sw 1G/^Subject: <CR>:s/Re:/was:/<CR>Wi (<C-O>$)<ESC>0Whi
121 map <Leader>ns 1G/^Subject: /<CR>:s,\(Subject: \)\(Re: \)*\(.*\)$,\1 (was: \3),<CR>:set nohls<CR>f li
123 " Delete 'was' in the Subject.
124 " Before: Subject: New (was: old)
125 " After : Subject: New
126 " http://strcat.de/wiki/dotfiles#vim
127 map <Leader>dw 1G/^Subject: /<CR>:s, *(was: .*)$<CR>:set nohls<CR>f l
129 " http://dollyfish.net.nz/blog/2008-04-01/mutt-and-vim-custom-autocompletion
130 fun! LBDBCompleteFn(findstart, base)
131 let line = getline('.')
133 " locate the start of the word
134 let start = col('.') - 1
135 while start > 0 && line[start - 1] =~ '[^:,]'
138 while start < col('.') && line[start] =~ '[:, ]'
144 let query = substitute(a:base, '"', '', 'g')
145 let query = substitute(query, '\s*<.*>\s*', '', 'g')
146 for m in LbdbQuery(query)
147 call complete_add(printf('"%s" <%s>', escape(m[0], '"'), m[1]))
155 set completefunc=LBDBCompleteFn
157 " And this magic by James Vega, which ensures that we only complete with lbdb
158 " on the recipient lines of the mail header.
159 inoremap <expr> <C-n> DelegateCompletion(1)
160 inoremap <expr> <C-p> DelegateCompletion(0)
162 fun! DelegateCompletion(next)
163 if getline('.') =~? '^\%(To\|B\=Cc\):'