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

Mon, 26 Aug 2024 14:23:43 -0500

author
Meredith Howard <mhoward@roomag.org>
date
Mon, 26 Aug 2024 14:23:43 -0500
changeset 1177
93b5d2db30bc
parent 1163
40367220022e
permissions
-rw-r--r--

more gopls config. add inlay hint toggle

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

mercurial