* Vineet Kumar <[EMAIL PROTECTED]> [08/27/01 11:50]:
> or how about this?
> set editor="vim '+/^> -- $/,/^-- $/-d'"
>
> Looks to me like that should delete everything between the quoted
> signature and my signature on starting vim. I guess it would poop out,
> though, if there is no quoted sigdash line in the original message.

To avoid the error when there's no sigdash line, you could use the
attached function. (thanks to Luc Hermitte for this one)

Call it from your ~/.vimrc with the following line:

   autocmd BufRead /tmp/mutt*   :call Mail_Erase_Sig()

-- 
Cedric
function! Mail_Erase_Sig()
  " Search for the signature pattern : "^> -- $"
  let i = line ('$')
  while i >= 1
    " This pattern takes into account signature delimiters from broken mailers
    " that forget the space after the two dashes
    if getline(i) =~ '^> *-- \=$'
      break
    endif
    let i = i - 1
  endwhile
  " If found, then
  if i != 0
    " First, search for the last non empty (non sig) line
    while i >= 1
        let i = i - 1
      " rem : i can't value 1
      if getline(i) !~ '^\(>\s*\)*$'
        break
      endif
    endwhile
    " Second, delete these lines plus the signature
    let i = i + 1
    exe 'normal '.i.'GdG'
  endif
endfunction

Reply via email to