.vim/ftplugin/mail.vim

Mon, 01 Aug 2016 15:23:12 -0400

author
Meredith Howard <mhoward@roomag.org>
date
Mon, 01 Aug 2016 15:23:12 -0400
changeset 361
7ab7173fb61f
parent 352
a19225f9b247
child 368
91d4fb4e0a42
permissions
-rw-r--r--

add autofmt toggle

349
976c8bf0499b set reflow_wrap = wrap
Meredith Howard <mhoward@roomag.org>
parents: 348
diff changeset
1
361
7ab7173fb61f add autofmt toggle
Meredith Howard <mhoward@roomag.org>
parents: 352
diff changeset
2 function! JumpAndInsert()
348
d72bc8c8d6f0 use text_flowed, move mail settings to ftplugin
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
3 if line('$') > 1
361
7ab7173fb61f add autofmt toggle
Meredith Howard <mhoward@roomag.org>
parents: 352
diff changeset
4 :0
348
d72bc8c8d6f0 use text_flowed, move mail settings to ftplugin
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
5 :/^$/
351
47b0510974fe fix up for reply/compose cursor pos
Meredith Howard <mhoward@roomag.org>
parents: 349
diff changeset
6 :normal 2]
348
d72bc8c8d6f0 use text_flowed, move mail settings to ftplugin
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
7 :+1
351
47b0510974fe fix up for reply/compose cursor pos
Meredith Howard <mhoward@roomag.org>
parents: 349
diff changeset
8 :exe 'startinsert'
348
d72bc8c8d6f0 use text_flowed, move mail settings to ftplugin
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
9 endif
d72bc8c8d6f0 use text_flowed, move mail settings to ftplugin
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
10 endfunction
d72bc8c8d6f0 use text_flowed, move mail settings to ftplugin
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
11
361
7ab7173fb61f add autofmt toggle
Meredith Howard <mhoward@roomag.org>
parents: 352
diff changeset
12 function! AutoFmtToggle()
7ab7173fb61f add autofmt toggle
Meredith Howard <mhoward@roomag.org>
parents: 352
diff changeset
13 if &formatoptions =~ 'a'
7ab7173fb61f add autofmt toggle
Meredith Howard <mhoward@roomag.org>
parents: 352
diff changeset
14 set fo-=a
7ab7173fb61f add autofmt toggle
Meredith Howard <mhoward@roomag.org>
parents: 352
diff changeset
15 echo '-a'
7ab7173fb61f add autofmt toggle
Meredith Howard <mhoward@roomag.org>
parents: 352
diff changeset
16 else
7ab7173fb61f add autofmt toggle
Meredith Howard <mhoward@roomag.org>
parents: 352
diff changeset
17 set fo+=a
7ab7173fb61f add autofmt toggle
Meredith Howard <mhoward@roomag.org>
parents: 352
diff changeset
18 echo '+a'
7ab7173fb61f add autofmt toggle
Meredith Howard <mhoward@roomag.org>
parents: 352
diff changeset
19 endif
7ab7173fb61f add autofmt toggle
Meredith Howard <mhoward@roomag.org>
parents: 352
diff changeset
20 endfunction
7ab7173fb61f add autofmt toggle
Meredith Howard <mhoward@roomag.org>
parents: 352
diff changeset
21
348
d72bc8c8d6f0 use text_flowed, move mail settings to ftplugin
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
22 augroup mail_filetype
d72bc8c8d6f0 use text_flowed, move mail settings to ftplugin
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
23 autocmd!
361
7ab7173fb61f add autofmt toggle
Meredith Howard <mhoward@roomag.org>
parents: 352
diff changeset
24 autocmd BufReadPost mutt-* :call JumpAndInsert()
348
d72bc8c8d6f0 use text_flowed, move mail settings to ftplugin
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
25 augroup END
d72bc8c8d6f0 use text_flowed, move mail settings to ftplugin
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
26
d72bc8c8d6f0 use text_flowed, move mail settings to ftplugin
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
27 setl textwidth=72
352
a19225f9b247 Numbered-list wrap doesn't work for flowed emails
Meredith Howard <mhoward@roomag.org>
parents: 351
diff changeset
28 setl formatoptions=aw
348
d72bc8c8d6f0 use text_flowed, move mail settings to ftplugin
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
29 setl spell
361
7ab7173fb61f add autofmt toggle
Meredith Howard <mhoward@roomag.org>
parents: 352
diff changeset
30
7ab7173fb61f add autofmt toggle
Meredith Howard <mhoward@roomag.org>
parents: 352
diff changeset
31 map <silent> <leader>a :call AutoFmtToggle()<CR>
7ab7173fb61f add autofmt toggle
Meredith Howard <mhoward@roomag.org>
parents: 352
diff changeset
32 imap <silent> <leader>a :call AutoFmtToggle()<CR>

mercurial