Rotating mail signatures
From Vim Tips Wiki
created June 12, 2001 · complexity intermediate · author Roel Vanhout · version 5.7
For people using mutt and Vim for mail, the following script will allow you to insert a new signature (and again and again if you don't like the current one) at the bottom of your mail. This is usefull eg when you don't want to send a potentially offensive quote to someone you don't know very well (or a mailing list), but are too lazy to delete the quote, open your quotes file, and cut and paste another one in. (I put it here in 'tips' and not in 'scripts' because it is imo too short to be a 'real' script)
" rotate_sig.vim " Maintainer: Roel Vanhout " Version: 0.1 " Last Change: Tuesday, June 12, 2001 " Mapping I use: " nnoremap ,r :call RotateSig()<CR> " Usage: " -Make sure you delimit your sig with '-- ', or adjust the script " -Adjust the last execute to a command that prints a sig to stdout " Known problems: " - You'll get an error message when you're below the last " '^-- $' in your mail (nothing bad though - just an not- " found marker) function! RotateSig() normal! mQG execute '?^-- $' execute ':nohl' normal! o<Esc> normal! dG normal! <CR> execute 'r !~/bin/autosig ~/.quotes \%' normal! `Q endfunction
I had an idea that this could be done better and shorter:
:nmap ,t mQG:?^-- $<CR>:nohl<CR>o<Esc>dG:r !~/bin/autosig ~/.quotes \%<CR>`Q
Mutt has an extensive hooks system that allows things like this.
set signature="fortune $HOME/.fortunes/other $HOME/.fortunes/computer |" send-hook '~t @networksolutions' 'unset signature' send-hook '~t @orkplace' 'set signature=~/.signature_official'
Now what I'd like to see is a thing that does a light keyword analysis on the message and select an appropriate quote emulating an extremely kind sigmonster :-)