diff options
author | hugues <hugues@a0e5b806-a6f9-0310-978d-cbce73f8a913> | 2007-05-24 14:56:56 +0000 |
---|---|---|
committer | hugues <hugues@a0e5b806-a6f9-0310-978d-cbce73f8a913> | 2007-05-24 14:56:56 +0000 |
commit | fff434fc00f9100bb039d5618fe6e8bc3b6054e9 (patch) | |
tree | 5813889f21209fb5ae4a64abb5b8819f3f57f21e | |
parent | 942cbb276fcec54f7d0770adfab6b08b344850ed (diff) |
Mutt tricks
git-svn-id: svn+ssh://hugues@maison/opt/svn/private/hugues@403 a0e5b806-a6f9-0310-978d-cbce73f8a913
-rw-r--r-- | vimrc | 64 |
1 files changed, 62 insertions, 2 deletions
@@ -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é <yk@cyberion.net> based on Luc Hermitte +" <hermitte@free.fr> 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 <ESC>n /^> $<CR> +autocmd BufRead /tmp/mutt-*[0-9] map ,n /^> $<CR> +autocmd BufRead /tmp/mutt-*[0-9] map <ESC>m ddO<CR> +autocmd BufRead /tmp/mutt-*[0-9] map <ESC>D ^d?^\([^>]\\|$\)?+<CR>O<ESC> +autocmd BufRead /tmp/mutt-*[0-9] map <ESC>d ^d/^-- $<CR>O<ESC> +autocmd BufRead /tmp/mutt-*[0-9] :normal ,n + |