On 2020-03-07 15:36, 'J S' via vim_use wrote:
> Thanks for all the replies. It seems that:
>
> 1) There's no really clean way to do it. It seems to me that there
> should be something like "linedo" - analogous to "windo" and
> "buffdo". Of the workarounds, the %g/./normal method seems the
> best. Thanks for that.
The typical way to write a "linedo" command is
:g/^/command
which is subtly different from
:g/./command
in the event that a line is empty. For your use-case, it doesn't
change anything, but if your change should also happen on empty line,
you'd want to use the "^" pattern because every line has one of those.
> 2) It just occurred to me that, for this specific case
> (reformatting each line), you could use "fmt -s" (at least on
> Unix/GNU version of "fmt").
which, if it would work, you could pipe the range through fmt:
:%!fmt -s
Always nice to have options :-)
-tim
--
--
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
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20200307095745.079f3629%40bigbox.attlocal.net.
No comments:
Post a Comment