.vim/ftplugin/mail.vim

changeset 361
7ab7173fb61f
parent 352
a19225f9b247
child 368
91d4fb4e0a42
equal deleted inserted replaced
360:951e2cf18190 361:7ab7173fb61f
1 1
2 function JumpAndInsert() 2 function! JumpAndInsert()
3 if line('$') > 1 3 if line('$') > 1
4 :0
4 :/^$/ 5 :/^$/
5 :normal 2] 6 :normal 2]
6 :+1 7 :+1
7 :exe 'startinsert' 8 :exe 'startinsert'
8 endif 9 endif
9 endfunction 10 endfunction
10 11
12 function! AutoFmtToggle()
13 if &formatoptions =~ 'a'
14 set fo-=a
15 echo '-a'
16 else
17 set fo+=a
18 echo '+a'
19 endif
20 endfunction
21
11 augroup mail_filetype 22 augroup mail_filetype
12 autocmd! 23 autocmd!
13 autocmd VimEnter /tmp/mutt* :call JumpAndInsert() 24 autocmd BufReadPost mutt-* :call JumpAndInsert()
14 augroup END 25 augroup END
15 26
16 setl textwidth=72 27 setl textwidth=72
17 setl formatoptions=aw 28 setl formatoptions=aw
18 setl spell 29 setl spell
30
31 map <silent> <leader>a :call AutoFmtToggle()<CR>
32 imap <silent> <leader>a :call AutoFmtToggle()<CR>

mercurial