Monday, March 5, 2012

Re: How to clear number registers

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.

I presume the help text in reference is the explanation under :help :exe
which explains that you can't start a 'while', 'for', or 'if' inside an
:exe and then finish it outside the :exe.

The :exe in the example is also allowed. The concatenated strings form
a whole command:

:exe "let @1 = ''"
:exe "let @2 = ''"
...etc.

--
Best,
Ben

--
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:

Post a Comment