.config/nvim/after/ftplugin/mail.vim

changeset 1029
9265f8508e4c
child 1125
58490a30d6fb
equal deleted inserted replaced
1028:77e65ab97892 1029:9265f8508e4c
1 setl textwidth=72
2 setl formatoptions=jaw12tcql
3 setl spell
4 setl noundofile noswapfile nobackup
5
6 setl equalprg=pandoc\ -f\ markdown\ -t\ markdown
7
8 " http://cedricduval.free.fr/download/mail.vim
9 function! Mail_Erase_Sig()
10 " search for the signature pattern (takes into account signature delimiters
11 " from broken mailers that forget the space after the two dashes)
12 let i = 0
13 while ((i <= line('$')) && (getline(i) !~ '^> *-- \=$'))
14 let i = i + 1
15 endwhile
16
17 " if found, then
18 if (i != line('$') + 1)
19 " first, look for our own signature, to avoid deleting it
20 let j = i
21 while (j < line('$') && (getline(j + 1) !~ '^-- $'))
22 let j = j + 1
23 endwhile
24
25 " second, search for the last non empty (non sig) line
26 while ((i > 0) && (getline(i - 1) =~ '^\(>\s*\)*$'))
27 let i = i - 1
28 endwhile
29
30 " third, delete those lines plus the signature
31 exe ':'.i.','.(j - 1).'d'
32 endif
33 endfunction
34
35 call Mail_Erase_Sig()
36
37 " Get right to composing the body:
38 if line('$') > 1 && line("'\"") < 1
39 :normal gg}
40 endif

mercurial