Ответ на сообщение «Re: Executing commands over a fold», 
присланное в 18:50:20 08 октября 2010, Пятница.
Отправитель: Ben Fritz:

> You're trying to execute a normal-mode command where an :ex command is
> 
> expected. What you are trying to do is:
> :folddoc normal! '<C-R>a'
> 
> However, may I instead suggest:
> 
> 1. Visually select the lines you wish to execute the command on (or
> use marks as you are doing)
> 2. :'<,'>normal! '<C-R>a'
«normal! '<C-r>a'» is a wrong syntax for expressing
    execute "normal! \<C-r>a"
What you have written is the same as
    execute "normal! '<"."C"."-R>a'"
or ``go to the start of selection ('<) and replace the text to the end-of-line 
(C) with «-R>a'»''. Please test your answer before you post it.


Текст сообщения:
> On Oct 7, 2:51 pm, Ven Tadipatri <[email protected]> wrote:
> > I'm really excited about the possibility about running a command over
> > a set of folds. What this would mean is that I could store a command,
> > then rather than trying to run it 10 times, see that I have a few more
> > lines to execute, run it again, hoping that I don't go too far,
> > instead I could fold the lines I want to execute the command over,
> > then only execute the command over what's folded. In fact I was so
> > excited, I started to add this to one of the wikia pages on folding.
> > But then I was slightly disappointed to see that the "command" that
> > folddoc expected didn't like my escape sequences.
> >    Could you help me determine what's wrong?
> > Store the keysequence into a buffer:
> > qa^i    ^[ (escape key)
> > Set the mark with ma, and go to the line I want to start the fold.
> > Make the fold to the mark that I've set
> > zf'a
> > 
> > Now, the part that doesn't work:
> > :folddoc <ctrl+r>a
> > 
> > Any help would greatly be appreciated.
> 
> You're trying to execute a normal-mode command where an :ex command is
> 
> expected. What you are trying to do is:
> :folddoc normal! '<C-R>a'
> 
> However, may I instead suggest:
> 
> 1. Visually select the lines you wish to execute the command on (or
> use marks as you are doing)
> 2. :'<,'>normal! '<C-R>a'
> 
> Note that if you press : in visual mode, the '<,'> automatically gets
> inserted on the line. This means, "do the command :normal! on every
> line in the visual selection".

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to