I use vim as my editor for messages I write using the mutt mail user agent. I'm pretty happy with it in general, but I do have problems remembering aliases. I was wishing for something that would allow me to type an alias in and it would provide help with when I had correct aliases, and expand them. I started off trying to make a completion thing, but most of my aliases aren't the same as what they'd expand to. So, I built a helper that expands correct aliases, and does nothing for incorrect ones.
This shows some of the flexibility of mutt with Python. In this, I can set up aliases in my ~/.aliases file, and then just type an alias in and hit the tab key to complete them. It only completes on To or Cc lines, so it doesn't muck up tabs I might type elsewhere.
I've released this code and uploaded it to our FTP site at ftp://ftp.tummy.com/pub/tummy/vim-mutt/
Included below is the README, for more information.
This code requires vim with Python extensions, and cooperates with mutt to do tab completion of To and Cc aliases. It reads the ~/.aliases file, and puts alias expansions into the message as you edit it.
To use, you will need to add the following to your ~/.vimrc:
autocmd BufRead,BufNewFile /tmp/mutt-* source $HOME/.vimrc-mutt
In the ~/.vimrc-mutt, you will need copy the "vimrc-mutt" file from this package. You may also want to set any things you want dealt with specially when editing messages in mutt in here.
Now, when you are on a line starting with 'To:' or 'Cc:' when editing a message in mutt, in the first 10 lines of the file, you can type an alias and hit "tab" and it will be expanded.
For example, if you have in your ~/.aliases file:
alias alice Alice <email@example.com> alias bob Bob <firstname.lastname@example.org> alias group alice, bob
You can type "alice
Enjoy.comments powered by Disqus