Monday, March 16, 2020

Re: Wrapg text at col. 80 on large-ish files - performance aspects.

On Mon, Mar 16, 2020 at 5:11 PM Chris Jones <cjns1989@gmail.com> wrote:
>
> On Sun, Mar 15, 2020 at 02:10:56PM EDT, Tim Chase wrote:
> > On 2020-03-15 11:44, Chris Jones wrote:
> > > What is the recommended way to wrap files at column 80 or thereabout
> > > when dealing with 5,000-10,000 lines files without a major
> > > performance hit?
> >
> > Strange. I do this regularly and have never encountered any issues.
> >
> > Have you attempted it without any plugins/non-defaults?
> >
> > $ vim -u NONE file_with_long_lines.txt
> >
> > Also, is there any difference if you use "gq" to reformat instead of
> > "gw" (maybe there's something weird in the "maintain the cursor
> > location" code)?
> >
> > > I tried searching for lines longer than 80 characters and running
> > > 'gwap' on the paragraph where they appear using the
> > > :g/long-line/gwap but this doesn't seem to help.
> >
> > I presume you mean something like
> >
> > :g/\%80c/norm gww
> >
> > > It takes something like 10 minutes to complete this task suggesting
> > > I am not doing it right.
> >
> > For a file that small, that's a ridiculous amount of time, so your
> > gut reaction is spot on. But I'd far sooner point the finger at some
> > rogue plugin than point it at something you're "not doing right",
> > 'cuz you *are* doing it right.
> >
> > > Is there a better way to do it inside a vim session or should I
> > > exit vim and run one of a number of utilities from the shell
> > > command prompt?
> >
> > The fmt(1) utility might lend a hand here, whether invoked inside vim:
> >
> > :%!fmt
> >
> > or externally
> >
> > $ fmt -80 file_with_long_lines.txt > wrapped_file.txt
> >
> > There's also a fold(1) utility that behaves similarly, with subtle
> > nuances in their differences, but for the most part, they should
> > behave roughly the same for this use-case.
> >
> [...]
>
> With vim - u NONE... & a set tw=80 a (normal) gggwG is quasi instaneous
> on a 5830 lines test file. With vim the way I have it set up ( that's
> what I really meant by 'doing it wrong'...) the same scenario took 15-16
> minutes to complete.
>
> I don't have that many plugins installed/loaded (cscope, zoomwin, and
> a few others that shouldn't interfere with buffer reformatting (they
> look like the kind that presumably just sits there doing nothing until
> you call them explicitly) so my impression is that this must be related
> to stuff that might cause vim to refresh the screen automatically such
> as perhaps my custom tabline and statusline (?)... after all if either
> vim or a widely-used plugin was the culprit the chances are other people
> would have had the problem & reported it.

To see if it's your custom tabline and/or statusline, you can load Vim
with your usual vimrc, then type

:set tal= stl=

and see if it makes a difference. If it does, then retry by setting
the one but not the other to empty (both ways) to see if it's the one,
the other, or both. Then look for "slow stuff" in whichever is/are the
culprit.


Best regards,
Tony.

--
--
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/CAJkCKXuTzVa0qzCJUismR-H%3DmD%3DDQGpYZHJFZPFXNmFXcg_5Kg%40mail.gmail.com.

No comments: