.vim/ftplugin/mail.vim

Tue, 25 Jul 2017 23:51:00 -0400

author
Meredith Howard <mhoward@roomag.org>
date
Tue, 25 Jul 2017 23:51:00 -0400
changeset 626
9dda9a69e7d1
parent 570
fe86d57f654a
child 657
628b4b962086
permissions
-rw-r--r--

drop sslsecure, degrades with many buffers

387
d16b5c66461a fix formatoptions and autorun
Meredith Howard <mhoward@roomag.org>
parents: 368
diff changeset
1 setl textwidth=72
d16b5c66461a fix formatoptions and autorun
Meredith Howard <mhoward@roomag.org>
parents: 368
diff changeset
2 setl formatoptions=jaw12tcql
d16b5c66461a fix formatoptions and autorun
Meredith Howard <mhoward@roomag.org>
parents: 368
diff changeset
3 setl spell
504
e4e09e3317ec Stop leaving junk around, keep this all in memory
Meredith Howard <mhoward@roomag.org>
parents: 434
diff changeset
4 setl noundofile noswapfile nobackup
349
976c8bf0499b set reflow_wrap = wrap
Meredith Howard <mhoward@roomag.org>
parents: 348
diff changeset
5
411
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
6 " http://cedricduval.free.fr/download/mail.vim
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
7 function! Mail_Erase_Sig()
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
8 " search for the signature pattern (takes into account signature delimiters
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
9 " from broken mailers that forget the space after the two dashes)
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
10 let i = 0
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
11 while ((i <= line('$')) && (getline(i) !~ '^> *-- \=$'))
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
12 let i = i + 1
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
13 endwhile
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
14
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
15 " if found, then
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
16 if (i != line('$') + 1)
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
17 " first, look for our own signature, to avoid deleting it
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
18 let j = i
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
19 while (j < line('$') && (getline(j + 1) !~ '^-- $'))
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
20 let j = j + 1
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
21 endwhile
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
22
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
23 " second, search for the last non empty (non sig) line
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
24 while ((i > 0) && (getline(i - 1) =~ '^\(>\s*\)*$'))
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
25 let i = i - 1
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
26 endwhile
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
27
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
28 " third, delete those lines plus the signature
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
29 exe ':'.i.','.(j - 1).'d'
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
30 endif
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
31 endfunction
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
32
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
33 call Mail_Erase_Sig()
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
34
387
d16b5c66461a fix formatoptions and autorun
Meredith Howard <mhoward@roomag.org>
parents: 368
diff changeset
35 " Get right to composing the body:
570
fe86d57f654a no autoinsert
Meredith Howard <mhoward@roomag.org>
parents: 504
diff changeset
36 if line('$') > 1 && line("'\"") < 1
fe86d57f654a no autoinsert
Meredith Howard <mhoward@roomag.org>
parents: 504
diff changeset
37 :normal gg}
387
d16b5c66461a fix formatoptions and autorun
Meredith Howard <mhoward@roomag.org>
parents: 368
diff changeset
38 endif

mercurial