Vim Tips Wiki
Advertisement

Previous TipNext Tip

Tip: #559 - Use Vim to expire your mail so Mutt will delete them later

Created: September 16, 2003 22:55 Complexity: basic Author: Nazri Ramliy Version: 6.0 Karma: 4/4 Imported from: Tip#559

Mutt has a feature to list expired mails (~E). Sadly, there's no built in way to

set the expiry date of a certain mail so I came up with a vim mapping to manually

insert the "Expiry:" field of the mail header. It will ask for the date the email should

expire (default is 'today') and then run the date command to produce the rfc-822

compliant date.


Here's the mapping and related function:


" Set expire date for the currently edited mail

nmap ,e gg/^Date: <CR>:call GetExpiryDate()<CR>:exe "normal! oExpires:\ndate --rfc-822 -d '". ExpiryDate."'"<ESC>!!sh<CR>kJ<CR>


function GetExpiryDate()

call inputsave() 
let g:ExpiryDate = input("Enter expiry date: ", "today") 
call inputrestore() 

endfunction

Comments

Advertisement