On Tue, Aug 25, 2015 at 10:00 PM, Quinn Strahl <[email protected]> wrote:
> A difference in behaviour between :g and :<range>normal recently frustrated 
> me, and I wonder if it's up for debate:
>
> :g does a pass on matching lines and marks them before performing the 
> operation; this allows it to be generally undeterred by operations that 
> include addition/deletion of lines.
>
> :<range>normal does not do this, and as a result, it can get "thrown off" by 
> such operations. For (a trivial) example, on the hypothetical file:
>
> foo
> bar
> baz
>
> Performing :1,3normal yyp would produce the following result:
>
> foo
> foo
> foo
> foo
> bar
> baz
>
> Whereas the more intuitive result would be:
>
> foo
> foo
> bar
> bar
> baz
> baz
>
> There does exist a workaround, in the form of :<range>g/^/normal yyp -- 
> simply using :g in a way guaranteed to match every line in the desired range 
> -- but this is a bit of a compositional kludge.
>
> Would it be feasible to add the marking behaviour of :g to :normal, or is 
> that not worth implementing / a feature?

Why do you want them to behave the same? They serve different
purposes. Or rather, :g serves a purpose, and :normal is behaving in
the typical way for a range command that performs edits/changes.


Justin M. Keyes

-- 
-- 
You received this message from the "vim_dev" 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

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui