mail.vim 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. " Vim filetype plugin file
  2. " Language: Mail
  3. " Maintainer: Bram Moolenaar <Bram@vim.org>
  4. " Last Change: 2012 Nov 20
  5. " Only do this when not done yet for this buffer
  6. if exists("b:did_ftplugin")
  7. finish
  8. endif
  9. let b:did_ftplugin = 1
  10. let b:undo_ftplugin = "setl modeline< tw< fo< comments<"
  11. " Don't use modelines in e-mail messages, avoid trojan horses and nasty
  12. " "jokes" (e.g., setting 'textwidth' to 5).
  13. setlocal nomodeline
  14. " many people recommend keeping e-mail messages 72 chars wide
  15. if &tw == 0
  16. setlocal tw=72
  17. endif
  18. " Set 'formatoptions' to break text lines and keep the comment leader ">".
  19. setlocal fo+=tcql
  20. " Add n:> to 'comments, in case it was removed elsewhere
  21. setlocal comments+=n:>
  22. " Add mappings, unless the user doesn't want this.
  23. if !exists("no_plugin_maps") && !exists("no_mail_maps")
  24. " Quote text by inserting "> "
  25. if !hasmapto('<Plug>MailQuote')
  26. vmap <buffer> <LocalLeader>q <Plug>MailQuote
  27. nmap <buffer> <LocalLeader>q <Plug>MailQuote
  28. endif
  29. vnoremap <buffer> <Plug>MailQuote :s/^/> /<CR>:noh<CR>``
  30. nnoremap <buffer> <Plug>MailQuote :.,$s/^/> /<CR>:noh<CR>``
  31. endif