.vim/ftplugin/mail.vim

Sat, 11 Feb 2017 16:59:48 -0500

author
Meredith Howard <mhoward@roomag.org>
date
Sat, 11 Feb 2017 16:59:48 -0500
changeset 512
da2cf0c3d734
parent 504
e4e09e3317ec
child 570
fe86d57f654a
permissions
-rw-r--r--

bash unnecessary

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:
d16b5c66461a fix formatoptions and autorun
Meredith Howard <mhoward@roomag.org>
parents: 368
diff changeset
36 if line('$') > 1
434
be837354e11b simplify mail autoinsert, disable cursor autojump for mail
Meredith Howard <mhoward@roomag.org>
parents: 411
diff changeset
37 :normal gg}o
be837354e11b simplify mail autoinsert, disable cursor autojump for mail
Meredith Howard <mhoward@roomag.org>
parents: 411
diff changeset
38 :startinsert
387
d16b5c66461a fix formatoptions and autorun
Meredith Howard <mhoward@roomag.org>
parents: 368
diff changeset
39 endif

mercurial