Wikia

Vim Tips Wiki

Changes: Use Vim to expire your mail so Mutt will delete them later

Edit

Back to page

(Remove html character entities)
(Change <tt> to <code>, perhaps also minor tweak.)
 
Line 3: Line 3:
 
|previous=558
 
|previous=558
 
|next=560
 
|next=560
|created=September 16, 2003
+
|created=2003
 
|complexity=basic
 
|complexity=basic
 
|author=Nazri Ramliy
 
|author=Nazri Ramliy
Line 11: Line 11:
 
|category2=
 
|category2=
 
}}
 
}}
Mutt has a feature to list expired mails (<tt>~E</tt>). 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 "<tt>Expiry:</tt>" 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.
+
Mutt has a feature to list expired mails (<code>~E</code>). 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 "<code>Expiry:</code>" 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:
 
Here's the mapping and related function:

Latest revision as of 05:35, July 13, 2012

Tip 559 Printable Monobook Previous Next

created 2003 · complexity basic · author Nazri Ramliy · version 6.0


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
nnoremap <buffer> <localleader>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

CommentsEdit

Around Wikia's network

Random Wiki