]> git.madduck.net Git - etc/vim.git/blob - .vim/ftplugin/mail.vim

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

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.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

change F8 to mtfk identity
[etc/vim.git] / .vim / ftplugin / mail.vim
1 nmap <buffer> <C-P><F1> :w<CR>:%!mailplate --keep-unknown official<CR>
2 nmap <buffer> <C-P><F2> :w<CR>:%!mailplate --keep-unknown private<CR>
3 nmap <buffer> <C-P><F3> :w<CR>:%!mailplate --keep-unknown pmv<CR>
4 nmap <buffer> <C-P><F4> :w<CR>:%!mailplate --keep-unknown pobox<CR>
5 nmap <buffer> <C-P><F5> :w<CR>:%!mailplate --keep-unknown debian<CR>
6 nmap <buffer> <C-P><F6> :w<CR>:%!mailplate --keep-unknown debconf<CR>
7 nmap <buffer> <C-P><F7> :w<CR>:%!mailplate --keep-unknown uniwh<CR>
8 nmap <buffer> <C-P><F8> :w<CR>:%!mailplate --keep-unknown mtfk<CR>
9 nmap <buffer> <C-P><F9> :w<CR>:%!mailplate --keep-unknown sudetia<CR>
10 nmap <buffer> <F1> :w<CR>:%!mailplate --auto --keep-unknown 2>/dev/null<CR>
11
12 " change subject line
13 " Before: Subject: old
14 " After : Subject: New (was: old)
15 " http://strcat.de/wiki/dotfiles#vim
16 " map ,sw 1G/^Subject: <CR>:s/Re:/was:/<CR>Wi (<C-O>$)<ESC>0Whi
17 map <Leader>ns 1G/^Subject: /<CR>:s,\(Subject: \)\(Re: \)*\(.*\)$,\1 (was: \3),<CR>:set nohls<CR>f li
18
19 " Delete 'was' in the Subject.
20 " Before: Subject: New (was: old)
21 " After : Subject: New
22 " http://strcat.de/wiki/dotfiles#vim
23 map <Leader>dw 1G/^Subject: /<CR>:s, *(was: .*)$<CR>:set nohls<CR>f l
24
25 " http://dollyfish.net.nz/blog/2008-04-01/mutt-and-vim-custom-autocompletion
26 fun! LBDBCompleteFn(findstart, base)
27   let line = getline('.')
28   if a:findstart
29     " locate the start of the word
30     let start = col('.') - 1
31     while start > 0 && line[start - 1] =~ '[^:,]'
32       let start -= 1
33     endwhile
34     while start < col('.') && line[start] =~ '[:, ]'
35       let start += 1
36     endwhile
37     return start
38   else
39     let res = []
40     let query = substitute(a:base, '"', '', 'g')
41     let query = substitute(query, '\s*<.*>\s*', '', 'g')
42     for m in LbdbQuery(query)
43       call complete_add(printf('"%s" <%s>', escape(m[0], '"'), m[1]))
44       if complete_check()
45         break
46       endif
47     endfor
48     return res
49   endif
50 endfun
51 set completefunc=LBDBCompleteFn
52
53 " And this magic by James Vega, which ensures that we only complete with lbdb
54 " on the recipient lines of the mail header.
55 inoremap <expr> <C-n> DelegateCompletion(1)
56 inoremap <expr> <C-p> DelegateCompletion(0)
57
58 fun! DelegateCompletion(next)
59   if getline('.') =~? '^\%(To\|B\=Cc\):'
60     return "\x18\x15"
61   elseif a:next
62     return "\x0e"
63   else
64     return "\x10"
65   endif
66 endfun