.vim/ftplugin/mail.vim

Mon, 23 Aug 2021 16:28:04 -0400

author
Meredith Howard <mhoward@roomag.org>
date
Mon, 23 Aug 2021 16:28:04 -0400
changeset 942
1d3b41412cf6
parent 657
628b4b962086
permissions
-rw-r--r--

improve tabular patterns

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
657
628b4b962086 Use pandoc as markdown equalprg, use only 72 for text width
Meredith Howard <mhoward@roomag.org>
parents: 570
diff changeset
6 setl equalprg=pandoc\ -f\ markdown\ -t\ markdown
628b4b962086 Use pandoc as markdown equalprg, use only 72 for text width
Meredith Howard <mhoward@roomag.org>
parents: 570
diff changeset
7
411
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
8 " http://cedricduval.free.fr/download/mail.vim
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
9 function! Mail_Erase_Sig()
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
10 " search for the signature pattern (takes into account signature delimiters
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
11 " 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
12 let i = 0
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
13 while ((i <= line('$')) && (getline(i) !~ '^> *-- \=$'))
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
14 let i = i + 1
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
15 endwhile
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
16
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
17 " if found, then
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
18 if (i != line('$') + 1)
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
19 " first, look for our own signature, to avoid deleting it
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
20 let j = i
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
21 while (j < line('$') && (getline(j + 1) !~ '^-- $'))
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
22 let j = j + 1
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
23 endwhile
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
24
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
25 " second, search for the last non empty (non sig) line
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
26 while ((i > 0) && (getline(i - 1) =~ '^\(>\s*\)*$'))
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
27 let i = i - 1
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
28 endwhile
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
29
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
30 " third, delete those lines plus the signature
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
31 exe ':'.i.','.(j - 1).'d'
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
32 endif
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
33 endfunction
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
34
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
35 call Mail_Erase_Sig()
1bb7fe33cd74 Add previous sig removal
Meredith Howard <mhoward@roomag.org>
parents: 387
diff changeset
36
387
d16b5c66461a fix formatoptions and autorun
Meredith Howard <mhoward@roomag.org>
parents: 368
diff changeset
37 " Get right to composing the body:
570
fe86d57f654a no autoinsert
Meredith Howard <mhoward@roomag.org>
parents: 504
diff changeset
38 if line('$') > 1 && line("'\"") < 1
fe86d57f654a no autoinsert
Meredith Howard <mhoward@roomag.org>
parents: 504
diff changeset
39 :normal gg}
387
d16b5c66461a fix formatoptions and autorun
Meredith Howard <mhoward@roomag.org>
parents: 368
diff changeset
40 endif

mercurial