Re: push/enter and my earlier questions
On Thu, Aug 09, 2007 at 02:49:02PM -0600, Kyle Wheeler wrote:
> On Thursday, August 9 at 09:32 PM, quoth Chris G:
> >>> macro index S ":push <enter-command>^Mset
> >>> mbox_type=maildir^M<save-message>"
> >>> macro index s ":push <enter-command>^Mset
> >>> mbox_type=mbox^M<save-message>"
>
> >> c) You don't need "push" for this, make it a simple macro.
> >>
> > How would I do this?
>
> macro index S '<enter-command>set mbox_type=maildir<enter><save-message>'
> macro index s '<enter-command>set mbox_type=mbox<enter><save-message>'
>
Quite! I was being silly wasn't I, the 'push' was just adding a layer
of do-nothing confusion. I think I ended up with the push because of
the route I had taken to get to what I wanted (that's my excuse
anyway).
The above works perfectly (and now I have "index,pager" I don't need
to repeat it).
> >>> Ah, I hadn't seen that there is an <enter-command> function which
> >>> effectively takes one to the : prompt, thank you. I'll experiment
> >>> some more.
> >>
> >> Hit '?', there you see all function names and current keybindings.
> >>
> > Er, yes, but there are over 100 of them and while I'm familiar with
> > quite a few of them I just hadn't noticed the <enter-command>.
>
> You don't need to "notice" them all, you just need to recognize that
> it's better to use the function that a key is bound to rather than the
> key itself when writing macros. Thus, you just need to say "okay, so I press
> the colon key to bring up the : prompt; what function is the colon key
> bound to?" Then it's a simple matter to use that keybinding display to
> look up : and discover that it is bound to the <enter-command>
> function.
>
Yes, thank you, what I *really* hadn't realised was that every bound
key must have a function behind it, including :. I think it's my vi
(well [x]vile actually) mentality where : is effectively a special key
and isn't like other command keys.
--
Chris Green