.vim/ftplugin/mail.vim

Mon, 01 Jan 2024 14:42:03 -0600

author
Meredith Howard <mhoward@roomag.org>
date
Mon, 01 Jan 2024 14:42:03 -0600
changeset 1143
5c37b939b296
parent 657
628b4b962086
permissions
-rw-r--r--

skip luasnip/jsregexp build on windows

setl textwidth=72
setl formatoptions=jaw12tcql
setl spell
setl noundofile noswapfile nobackup

setl equalprg=pandoc\ -f\ markdown\ -t\ markdown

" http://cedricduval.free.fr/download/mail.vim
function! Mail_Erase_Sig()
  " search for the signature pattern (takes into account signature delimiters
  " from broken mailers that forget the space after the two dashes)
  let i = 0
  while ((i <= line('$')) && (getline(i) !~ '^> *-- \=$'))
    let i = i + 1
  endwhile

  " if found, then
  if (i != line('$') + 1)
    " first, look for our own signature, to avoid deleting it
    let j = i
    while (j < line('$') && (getline(j + 1) !~ '^-- $'))
      let j = j + 1
    endwhile

    " second, search for the last non empty (non sig) line
    while ((i > 0) && (getline(i - 1) =~ '^\(>\s*\)*$'))
      let i = i - 1
    endwhile

    " third, delete those lines plus the signature
    exe ':'.i.','.(j - 1).'d'
  endif
endfunction

call Mail_Erase_Sig()

" Get right to composing the body:
if line('$') > 1 && line("'\"") < 1
  :normal gg}
endif

mercurial