On Fri, Dec 21, 2012 at 08:45:49AM +1100, Cameron Simpson wrote: > On 20Dec2012 21:55, Woody Wu <narkewo...@gmail.com> wrote: > | On Thu, Dec 20, 2012 at 09:29:25PM +0800, Woody Wu wrote: > | > Is the 'sourcing' means the same thing as that in bash script? I write > | > '. ~/.mail_aliases' in the .muttrc, but mutt said it's an syntax error. > | > | sorry for the stupid asking, I found out its 'source ~/.mail_aliases'. > | Please forget this question. > > It is nice to see someone spelling "source" as "." in the shell. Too > many people use the new fangled long word:-) > > | > On the hand, I found my .muttrc has some default alias definitions like > | > what you guy said. For example: > | > > | > alias mutt-users Mutt User List <mutt-users@mutt.org> > | > > | > I tried to use this alias by pressing <tab> after I inputted words > | > 'mutt-users' after the 'To:' header in mutt. But I still got nothing. > | > Is there something to do with my message editor? Here it is vim. > | > | This still doesn't work. I tried to remove my vimrc file and all the > | locally installed plugins. I still cannot use the <tab> :( What's wrong > | with my system? > > As Christian said, vim itself is not aware of mutt stuff (unless you > tell it; I do not know how, myself). > > The tab completion for aliases probably only works in the message setup. > It sounds like you have: > > set autoedit=yes > set edit_headers=yes > > so that mutt drops you straight into the whole message to edit. That is > how I work also. When you quit the editor, but before typing "y" to send > the message, you are in a mode showing TO and CC and Subject and > attachments etc. > > At that point to can type "t" to edit the TO line or "c" to edit the CC > line and so forth. I think the <TAB> completion for aliases will word > then, editing those fields. > > So: > - exit editor > - type "t" to edit to To: header > - type <TAB> to complete - having no alias it will enter the alias > menu for you to select an alias; if you type the start of an alias > it will complete, or enter to menu if ambiguous > - after editing the header, type "e" to return to editing the message >
Now I understand the way to go, and it works! Many thanks Cameron. If you still have time, here is another question :) Instead of editing the .mail_aliase file by hand, does mutt support this by somehow automatically add an aliase to me when I is viewing a new message? I guess there should be a way but realy cannt find it in the mutt user guide. > If someone knows how to write vim ":" commands to make vim do <TAB> > completion, I can probably write a short script to read a mutt alias file > (or any filter with mutt alias commands in it) and emit vim commands to > match, to go in a vimrc file somewhere. That might get to alias expansion > inside vim. I belive there is a vim plug that can do word completion when you press tab in a, for example, c langue file. I don't remember the name of the plugin and also not sure it can be modified to let it query mutt aliases. > > Cheers, > -- > Cameron Simpson <c...@zip.com.au> > > I made this letter longer than usual because I lack the time to make it > shorter. - Pascal -- woody I can't go back to yesterday - because I was a different person then.