Monday, March 5, 2012

Re: How to clear number registers

On 2012-03-05, Benjamin R. Haskell wrote:
> On Mon, 5 Mar 2012, Gary Johnson wrote:
> >On 2012-03-04, howardb21 wrote:
> >>On Mar 4, 1:49 am, Paul Isambert wrote:
> >>
> >>>You should use ":exe[cute]":
> >>>  au BufRead * for i in range(1,9) | exe "let @" . i . " = ''" | endfor
> >>
> >>[...]
> >>I did try a version of execute, but I read in the docs that you
> >>could not use exe on part of a command. You had to execute the
> >>whole line, even if it contained multiple commands.
> >
> >Where did you read that? Your conclusion is incorrect, so perhaps
> >the documentation needs to be more clear.
>
> The conclusion is correct, but it doesn't apply to the situation at
> hand. There's no "part of a command" being executed.

It seemed to me that Howard had concluded that placing the exe in
the middle of that autocommand was incorrect as it was affecting
only part of the autocommand, and that the exe had to be applied to
the entire command, as either something like this

au BufRead * exe "for i in range(1,9) |let @" . i . " = '' | endfor"

or like this

exe "au BufRead * for i in range(1,9) | let @" . i . " = '' | endfor"

(Yes, I know neither of those will work and are probably
syntactically incorrect as well.) If that was his conclusion from
some statement in the docs, then his conclusion was incorrect.

Regards,
Gary

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: