Wikia

Vim Tips Wiki

Insert mail signatures from a rotating file

Talk0
1,612pages on
this wiki

Redirected from VimTip106

Tip 106 Printable Monobook Previous Next

created 2001 · complexity basic · author brz · version 6.0


By adding the following line to your vimrc, you can use a simple email signature rotator:

map <Leader>ms :e c:\sign.txt<CR>ggV/^--  $<CR>k"*xG$a<C-R><C-O>*<Esc>:w<CR>:bd<CR>G$a<C-M><Esc>"*P

This rotator expects the user to have a file at the location C:/sign.txt with the following information:

--
first signature
--
second signature
--
third signature
--

When a user finishes an email, they may call the shortcut \ms and the 'first signature' will be inserted into the email. This will also push the first signature in C:\sign.txt to the end of the file. To change to a different signature from the one which is next in the file type u and \ms again.

The sign.txt file must employ a signature separator like the following: '-- '.

CommentsEdit

Around Wikia's network

Random Wiki