On Wednesday, 26 August 2015 01:31:34 UTC-4, Justin M. Keyes wrote: > On Tue, Aug 25, 2015 at 10:00 PM, Quinn Strahl <qstr...@gmail.com> 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
I have on many occasions run into situations where it would be very handy if :normal worked the way :g does with respect to how it handles changes in number of lines during operation, and I have not run into any case (nor can I imagine one) where the current behaviour is favourable. It seems less intuitive and less useful for it to behave this way. -- -- 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 vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.