Loading ...
Sorry, an error occurred while loading the content.

RE: Inline script execution

Expand Messages
  • Daryl Lee
    I m pasting an expanded section of the usr_41.txt description of script writing, section 41.1: ... Let s start with a simple example: ... Note: The :
    Message 1 of 9 , Oct 31, 2006
    • 0 Attachment
      I'm pasting an expanded section of the usr_41.txt description of
      script writing, section 41.1:

      ...
      Let's start with a simple example: >

      :let i = 1
      :while i < 5
      : echo "count is" i
      : let i += 1
      :endwhile

      Note:
      The ":" characters are not really needed here. You only need
      to use
      them when you type a command. In a Vim script file they can
      be left
      out. We will use them here anyway to make clear these are
      colon
      commands and make them stand out from Normal mode commands.
      Note:
      You can try out the examples by yanking the lines from the
      text here
      and executing them with :@"
      ...

      Copying the script to a file and executing it with the :source command
      works correctly. I suppose it's possible that the :@" command has
      changed and the documentation hasn't?

      Daryl
      -----Original Message-----
      From: A.J.Mechelynck [mailto:antoine.mechelynck@...]
      Sent: Monday, October 30, 2006 10:02 PM
      To: dlee@...
      Cc: 'Vim'
      Subject: Re: Inline script execution

      Daryl Lee wrote:
      > -----Original Message-----
      > From: A.J.Mechelynck [mailto:antoine.mechelynck@...]
      > Sent: Monday, October 30, 2006 9:28 PM
      > To: dlee@...
      > Cc: Vim
      > Subject: Re: Inline script execution
      >
      > Daryl Lee wrote:
      >> I am working my way through the :help scripting explanation
      >> (usr_41.txt) and I have a question about the :@" command. I ran
      the
      >
      >> sample given in the explanation, where the "simple example" is:
      >>
      >> :let i = 1
      >> :while i < 5
      >> : echo "count is" i
      >> : let i += 1
      >> :endwhile
      >>
      >> And the expected output is
      >>
      >> count is 1
      >> count is 2
      >> count is 3
      >> count is 4
      >>
      >> What I got was
      >>
      >> :^I:let i = 1
      >> :^I:while i < 5
      >> : ^I: echo "count is" i
      >> count is 1
      >> : ^I: let i += 1
      >> : ^I:endwhile
      >> count is 2
      >> count is 3
      >> count is 4
      >>
      >> Obviously, something is causing the commands to be echoed. I tried

      >> copying the lines into a separate buffer and deleting the colons,
      > but
      >> that didn't fix the problem. Is there something that should be set

      >> and isn't?
      >>
      >> Daryl
      >>
      >>
      >
      > What is your 'verbose' setting? See :help 'verbose'
      >
      >
      > Best regards,
      > Tony.
      ----- End Original Message -----

      > Verbose = 0. I tried raising it (to 10) and that just made things
      > worse.
      >
      > Daryl
      >

      I was thinking a nonzero 'verbose' setting might be the culprit.
      Apparently it isn't.

      You are talking about "the example given in the explanation for the :@
      command". I don't see any such example under ":help :@ " (in
      *repeat.txt* For Vim version 7.0. Last change: 2006 Sep 20
      at lines 120 sqq.). Where are you seeing that "example"?


      Best regards,
      Tonoy.
    Your message has been successfully submitted and would be delivered to recipients shortly.