From fff434fc00f9100bb039d5618fe6e8bc3b6054e9 Mon Sep 17 00:00:00 2001 From: hugues Date: Thu, 24 May 2007 14:56:56 +0000 Subject: Mutt tricks git-svn-id: svn+ssh://hugues@maison/opt/svn/private/hugues@403 a0e5b806-a6f9-0310-978d-cbce73f8a913 --- vimrc | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 62 insertions(+), 2 deletions(-) (limited to 'vimrc') diff --git a/vimrc b/vimrc index fe62e63..70467b0 100644 --- a/vimrc +++ b/vimrc @@ -1,5 +1,5 @@ syntax on -color zellner +color pablo set title @@ -8,7 +8,9 @@ set mousem=extend set tabstop=4 set shiftwidth=4 -" autocmd BufRead mutt* set textwidth=76 +" Config spécifique pour les mails +autocmd BufRead /tmp/mutt-*[0-9] set textwidth=74 +autocmd BufRead /tmp/mutt-*[0-9] color elflord set guifont=LucidaTypewriter\ 8 @@ -61,3 +63,61 @@ augroup bencrypted " after the file has been written. autocmd BufWritePost,FileWritePost *.gpg u augroup END + + + +" Function: Erase_Sig_but_Your() +" Purpose: Delete signatures at the end of e-mail replies. But keep +" your sig intact. (if mutt (or other MUA) had added it) +" Features: * Does not beep when no signature is found +" * Also deletes the empty lines (even those beginning by '>') +" preceding the signature. +" * keep your sig intact +" Author: Yann Kerhervé based on Luc Hermitte +" work + +" here was my beeping macro :) +function! Erase_Sig_but_Your() + " Search for the signature pattern : "^> -- $" + let lastline = line ('$') + let i = lastline + " (1) + while i >= 1 + if getline(i) =~ '^> *-- $' + break + endif + let i = i - 1 + endwhile + " let find the beginning of our sig + let j = i + while j < lastline + let j = j + 1 + if getline(j) =~ '^-- $' + let j = j - 1 + break + endif + endwhile + " If (1) 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.'Gd'.j.'G' + endif +endfunction + +autocmd BufRead /tmp/mutt-*[0-9] execute Erase_Sig_but_Your() +autocmd BufRead /tmp/mutt-*[0-9] map n /^> $ +autocmd BufRead /tmp/mutt-*[0-9] map ,n /^> $ +autocmd BufRead /tmp/mutt-*[0-9] map m ddO +autocmd BufRead /tmp/mutt-*[0-9] map D ^d?^\([^>]\\|$\)?+O +autocmd BufRead /tmp/mutt-*[0-9] map d ^d/^-- $O +autocmd BufRead /tmp/mutt-*[0-9] :normal ,n + -- cgit v1.2.3