Loading ...
Sorry, an error occurred while loading the content.

vim7 chokes on simple text file

Expand Messages
  • Daniel Fetchinson
    Hi vimers, I ve upgraded to vim 7 recently and to my biggest surprise I ve noticed that this most recent version of vim chokes on a simple text file (it s
    Message 1 of 13 , Jan 5, 2008
    • 0 Attachment
      Hi vimers,

      I've upgraded to vim 7 recently and to my biggest surprise I've
      noticed that this most recent version of vim chokes on a simple text
      file (it's javascript source for the ext.js javascript library):
      http://extjs.com/deploy/dev/adapter/ext/ext-base.js

      The file is small the only peculiarity is that it has 2 very long
      lines. I always liked vim because it was the most robust editor out
      there but I'm not really sure why this simple text file is giving it
      such a hard time. I renamed it to something else so the javascript
      syntax highlighting doesn't kick in and still CPU usage shoots up to
      100% when I'm moving around the file.

      Unfortunately I don't have the earlier version of vim anymore but I
      don't think I've seen anything like this with those earlier very
      stable releases. Anyone could check it out so we know if it's version
      7 specific or something else?

      Cheers,
      Daniel

      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Tony Mechelynck
      ... Works for me (even with js syntax highlighting) on Linux with gvim 7.1.203 for GTK2/Gnome. Moving around (e.g. using j k etc.) gives me no problem. I
      Message 2 of 13 , Jan 5, 2008
      • 0 Attachment
        Daniel Fetchinson wrote:
        > Hi vimers,
        >
        > I've upgraded to vim 7 recently and to my biggest surprise I've
        > noticed that this most recent version of vim chokes on a simple text
        > file (it's javascript source for the ext.js javascript library):
        > http://extjs.com/deploy/dev/adapter/ext/ext-base.js
        >
        > The file is small the only peculiarity is that it has 2 very long
        > lines. I always liked vim because it was the most robust editor out
        > there but I'm not really sure why this simple text file is giving it
        > such a hard time. I renamed it to something else so the javascript
        > syntax highlighting doesn't kick in and still CPU usage shoots up to
        > 100% when I'm moving around the file.
        >
        > Unfortunately I don't have the earlier version of vim anymore but I
        > don't think I've seen anything like this with those earlier very
        > stable releases. Anyone could check it out so we know if it's version
        > 7 specific or something else?
        >
        > Cheers,
        > Daniel

        Works for me (even with js syntax highlighting) on Linux with gvim 7.1.203 for
        GTK2/Gnome. Moving around (e.g. using j k <End> etc.) gives me no problem. I
        didn't try making changes in the long lines.

        - You say "vim chokes". What are the exact symptoms you got?
        - Does it or doesn't it work with

        gvim -N -u NORC

        and/or with something similar to

        gvim -u "C:\Program Files\vim\vim71\vimrc_example.vim"
        gvim -u /usr/local/share/vim/vim71/vimrc_example.vim

        etc. (depending on where the Vim 7 runtime files are on your system)?

        If it works with one of the above, the problem is probably with your vimrc.


        I notice that the last two lines (several thousand characters long) end in LF
        only while the rest ("short" lines) end in CR+LF. Is that intentional? I can
        cure it (on my gvim which reads the file with no problem) using

        :set ffs=
        :e ++ff=dos ext-base.js
        :w ++ff=unix
        " or just :w if you want CR+LF all over
        :q


        Best regards,
        Tony.
        --
        A classic is something that everybody wants to have read and nobody
        wants to read.
        -- Mark Twain

        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_use" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      • Martin Lange
        ... I can t confirm your report. I downloaded the source, you mentioned, form ... and open it from the command-line in my installation of vim, which is the
        Message 3 of 13 , Jan 5, 2008
        • 0 Attachment
          At Sunday 06 January 2008 07:41:35, Daniel Fetchinson wrote:

          > [...] Anyone could check it out so we know if it's version
          > 7 specific or something else?

          I can't confirm your report.

          I downloaded the source, you mentioned, form

          > http://extjs.com/deploy/dev/adapter/ext/ext-base.js

          and open it from the command-line in my installation of vim, which is
          the version from FreeBSD-ports system:

          VIM - Vi IMproved 7.1 (2007 May 12, compiled Dec 20 2007 19:09:40)
          Included patches: 1-2, 4-6, 8-40, 42-64, 66-69, 71, 73-79, 81-87, 89-90,
          93-123, 125, 127, 130-133, 135-145, 147-157, 159-167, 169-175

          vim read the file without any trouble in "no time".

          The first 8 lines hold a comment (and some ^Ms). Line 9 is 7536 columns
          wide and line 10 has 27511 columns.

          Goes like a charm.

          Martin "vi"
        • Daniel Fetchinson
          ... I have VIM 7.1 (2007 May 12, compiled Oct 4 2007 10:45:32) Included patches: 1-135 Modified by Also on linux. ... CPU usage shootes
          Message 4 of 13 , Jan 5, 2008
          • 0 Attachment
            > > I've upgraded to vim 7 recently and to my biggest surprise I've
            > > noticed that this most recent version of vim chokes on a simple text
            > > file (it's javascript source for the ext.js javascript library):
            > > http://extjs.com/deploy/dev/adapter/ext/ext-base.js
            > >
            > > The file is small the only peculiarity is that it has 2 very long
            > > lines. I always liked vim because it was the most robust editor out
            > > there but I'm not really sure why this simple text file is giving it
            > > such a hard time. I renamed it to something else so the javascript
            > > syntax highlighting doesn't kick in and still CPU usage shoots up to
            > > 100% when I'm moving around the file.
            > >
            > > Unfortunately I don't have the earlier version of vim anymore but I
            > > don't think I've seen anything like this with those earlier very
            > > stable releases. Anyone could check it out so we know if it's version
            > > 7 specific or something else?
            > >
            > > Cheers,
            > > Daniel
            >
            > Works for me (even with js syntax highlighting) on Linux with gvim 7.1.203
            > for
            > GTK2/Gnome.

            I have VIM 7.1 (2007 May 12, compiled Oct 4 2007 10:45:32)
            Included patches: 1-135
            Modified by <bugzilla@...>

            Also on linux.

            > Moving around (e.g. using j k <End> etc.) gives me no problem. I
            > didn't try making changes in the long lines.
            >
            > - You say "vim chokes". What are the exact symptoms you got?

            CPU usage shootes up to 100% for an extended period of time (5-10
            seconds) and vim becomes unresponsive in the meantime.

            These are the steps which are consistently reproducing the issue:

            1. open the file
            2. gg
            2. move a couple of line down until the last line starting with
            (function(........
            3. move right until you hit the first curly bracket {
            4. CPU usage shoots up to 100% and vim becomes unresponsive
            5. after 5-10 seconds vim comes back live

            Maybe "choking" is too strong a word :)
            Vim doesn't actually hang just takes a little time out.

            The problem is clearly with finding the matching braces, } in the above case.

            > - Does it or doesn't it work with
            >
            > gvim -N -u NORC

            Same as above.

            > and/or with something similar to
            >
            > gvim -u "C:\Program Files\vim\vim71\vimrc_example.vim"
            > gvim -u /usr/local/share/vim/vim71/vimrc_example.vim
            >
            > etc. (depending on where the Vim 7 runtime files are on your system)?
            >
            > If it works with one of the above, the problem is probably with your vimrc.
            >
            >
            > I notice that the last two lines (several thousand characters long) end in
            > LF
            > only while the rest ("short" lines) end in CR+LF. Is that intentional?

            I have no idea :) I didn't write this code just came across it from
            the ext.js website.

            > I can
            > cure it (on my gvim which reads the file with no problem) using
            >
            > :set ffs=
            > :e ++ff=dos ext-base.js
            > :w ++ff=unix
            > " or just :w if you want CR+LF all over
            > :q
            >
            >
            > Best regards,
            > Tony.


            Cheers,
            Daniel

            --~--~---------~--~----~------------~-------~--~----~
            You received this message from the "vim_use" maillist.
            For more information, visit http://www.vim.org/maillist.php
            -~----------~----~----~----~------~----~------~--~---
          • Tony Mechelynck
            Daniel Fetchinson wrote: Tony Mechelynck wrote: [...] ... actually, VIM - Vi IMproved 7.1 (2007 May 12, compiled Jan 5 2008 06:45:02) Included patches: 1-203
            Message 5 of 13 , Jan 6, 2008
            • 0 Attachment
              Daniel Fetchinson wrote:
              Tony Mechelynck wrote:
              [...]
              >> Works for me (even with js syntax highlighting) on Linux with gvim 7.1.203
              >> for
              >> GTK2/Gnome.

              actually,

              VIM - Vi IMproved 7.1 (2007 May 12, compiled Jan 5 2008 06:45:02)
              Included patches: 1-203
              Modified by Bram Moolenaar (filename-completion)
              Compiled by antoine.mechelynck@...
              Huge version with GTK2-GNOME GUI. Features included (+) or not (-):

              etc.

              >
              > I have VIM 7.1 (2007 May 12, compiled Oct 4 2007 10:45:32)
              > Included patches: 1-135
              > Modified by <bugzilla@...>
              >
              > Also on linux.
              >
              >> Moving around (e.g. using j k <End> etc.) gives me no problem. I
              >> didn't try making changes in the long lines.
              >>
              >> - You say "vim chokes". What are the exact symptoms you got?
              >
              > CPU usage shootes up to 100% for an extended period of time (5-10
              > seconds) and vim becomes unresponsive in the meantime.
              >
              > These are the steps which are consistently reproducing the issue:
              >
              > 1. open the file

              works for me

              > 2. gg
              > 2. move a couple of line down until the last line starting with
              > (function(........

              hit G -- gvim hangs for a time but eventually gets there. Going back (gg) and
              forward again (G) give further temporary hangs

              > 3. move right until you hit the first curly bracket {

              /{
              cursor moves immediately but stops blinking for a time. Then blinking resumes
              but cursor doesn't respond (or only extremely sluggishly) to the cursor
              movement keys

              > 4. CPU usage shoots up to 100% and vim becomes unresponsive

              I get gvim steadily using between 40% and 60% of my total CPU time, which is
              unusual.

              > 5. after 5-10 seconds vim comes back live
              >
              > Maybe "choking" is too strong a word :)
              > Vim doesn't actually hang just takes a little time out.

              I guess Vim isn't optimized for the handling of 27511-character lines.

              I tried:

              :filetype indent off
              ggVGgq

              (reformat the whole file). It went slowly, but after that the "temporary
              hangs" disappeared completely. So I tried

              :filetype indent on
              :w
              :e
              ggVGgq

              which added enormous lots of tabs, especially near the end. I had to undo.

              The (first) reformat apparently adds linebreaks only where there are spaces,
              which isn't ideal for such an uglily-written file. I can only say that (as
              someone who, 30 or 40 years ago, often had to take up COBOL programs written
              by other people and make them "work right") I totally disapprove with the
              "coding style" of whoever wrote that JS program.

              Best regards,
              Tony.
              --
              Mencken and Nathan's Ninth Law of The Average American:
              The quality of a champagne is judged by the amount of noise the
              cork makes when it is popped.

              --~--~---------~--~----~------------~-------~--~----~
              You received this message from the "vim_use" maillist.
              For more information, visit http://www.vim.org/maillist.php
              -~----------~----~----~----~------~----~------~--~---
            • Ben Schmidt
              ... I think with A. Politz that it s Matchparen, as when my Vim slows down while navigating the file and I do Ctrl-C I get told that Highlight_Matching_Pair
              Message 6 of 13 , Jan 6, 2008
              • 0 Attachment
                Daniel Fetchinson wrote:
                >>> I've upgraded to vim 7 recently and to my biggest surprise I've
                >>> noticed that this most recent version of vim chokes on a simple text
                >>> file (it's javascript source for the ext.js javascript library):
                >>> http://extjs.com/deploy/dev/adapter/ext/ext-base.js
                >>>
                >>> The file is small the only peculiarity is that it has 2 very long
                >>> lines. I always liked vim because it was the most robust editor out
                >>> there but I'm not really sure why this simple text file is giving it
                >>> such a hard time. I renamed it to something else so the javascript
                >>> syntax highlighting doesn't kick in and still CPU usage shoots up to
                >>> 100% when I'm moving around the file.

                I think with A. Politz that it's Matchparen, as when my Vim slows down while
                navigating the file and I do Ctrl-C I get told that Highlight_Matching_Pair (or
                similar) is being interrupted.

                :NoMatchParen

                fixes it for me, and I expect will for you, too, if that is indeed the problem.

                Ben.




                Send instant messages to your online friends http://au.messenger.yahoo.com


                --~--~---------~--~----~------------~-------~--~----~
                You received this message from the "vim_use" maillist.
                For more information, visit http://www.vim.org/maillist.php
                -~----------~----~----~----~------~----~------~--~---
              • A.Politz
                ... Turn of matchparen with the command :NoMatchParen and see if that helps. It is a new standard plugin in vim7. -ap -- Ich hab geträumt, der Krieg wär
                Message 7 of 13 , Jan 6, 2008
                • 0 Attachment
                  Daniel Fetchinson wrote:

                  >
                  >The problem is clearly with finding the matching braces, } in the above case.
                  >
                  >
                  >
                  Turn of matchparen with the command ':NoMatchParen' and
                  see if that helps.
                  It is a new standard plugin in vim7.

                  -ap

                  --
                  Ich hab geträumt, der Krieg wär vorbei.


                  --~--~---------~--~----~------------~-------~--~----~
                  You received this message from the "vim_use" maillist.
                  For more information, visit http://www.vim.org/maillist.php
                  -~----------~----~----~----~------~----~------~--~---
                • Tony Mechelynck
                  ... For me it does. Best regards, Tony. -- We ARE as gods and might as well get good at it. -- Whole Earth Catalog
                  Message 8 of 13 , Jan 6, 2008
                  • 0 Attachment
                    A.Politz wrote:
                    > Daniel Fetchinson wrote:
                    >
                    >> The problem is clearly with finding the matching braces, } in the above case.
                    >>
                    >>
                    >>
                    > Turn of matchparen with the command ':NoMatchParen' and
                    > see if that helps.
                    > It is a new standard plugin in vim7.
                    >
                    > -ap
                    >

                    For me it does.

                    Best regards,
                    Tony.
                    --
                    We ARE as gods and might as well get good at it.
                    -- Whole Earth Catalog

                    --~--~---------~--~----~------------~-------~--~----~
                    You received this message from the "vim_use" maillist.
                    For more information, visit http://www.vim.org/maillist.php
                    -~----------~----~----~----~------~----~------~--~---
                  • Daniel Fetchinson
                    ... Thanks guys, that indeed fixes it! --~--~---------~--~----~------------~-------~--~----~ You received this message from the vim_use maillist. For more
                    Message 9 of 13 , Jan 6, 2008
                    • 0 Attachment
                      > >> The problem is clearly with finding the matching braces, } in the above
                      > case.
                      > >>
                      > >>
                      > >>
                      > > Turn of matchparen with the command ':NoMatchParen' and
                      > > see if that helps.
                      > > It is a new standard plugin in vim7.
                      > >
                      > > -ap
                      > >
                      >
                      > For me it does.
                      >
                      > Best regards,
                      > Tony.


                      Thanks guys, that indeed fixes it!

                      --~--~---------~--~----~------------~-------~--~----~
                      You received this message from the "vim_use" maillist.
                      For more information, visit http://www.vim.org/maillist.php
                      -~----------~----~----~----~------~----~------~--~---
                    • Daniel Fetchinson
                      ... I agree, it s not the best choice for having that many characters in a line. How would I make vim break these lines up into shorter pieces so that the
                      Message 10 of 13 , Jan 6, 2008
                      • 0 Attachment
                        > I guess Vim isn't optimized for the handling of 27511-character lines.
                        >
                        > I tried:
                        >
                        > :filetype indent off
                        > ggVGgq
                        >
                        > (reformat the whole file). It went slowly, but after that the "temporary
                        > hangs" disappeared completely. So I tried
                        >
                        > :filetype indent on
                        > :w
                        > :e
                        > ggVGgq
                        >
                        > which added enormous lots of tabs, especially near the end. I had to undo.
                        >
                        > The (first) reformat apparently adds linebreaks only where there are spaces,
                        > which isn't ideal for such an uglily-written file. I can only say that (as
                        > someone who, 30 or 40 years ago, often had to take up COBOL programs written
                        > by other people and make them "work right") I totally disapprove with the
                        > "coding style" of whoever wrote that JS program.


                        I agree, it's not the best choice for having that many characters in a line.
                        How would I make vim break these lines up into shorter pieces so that
                        the javascript logic doesn't break (i.e. no line breaks on words but
                        only around ( { ) } and such signs)?

                        Cheers,
                        Daniel

                        --~--~---------~--~----~------------~-------~--~----~
                        You received this message from the "vim_use" maillist.
                        For more information, visit http://www.vim.org/maillist.php
                        -~----------~----~----~----~------~----~------~--~---
                      • Tony Mechelynck
                        ... maybe (untested) add space before ( [ { when preceded by non-whitespace ... add space after ) ] } ; , . when followed by non-whitespace ... reformat
                        Message 11 of 13 , Jan 6, 2008
                        • 0 Attachment
                          Daniel Fetchinson wrote:
                          >> I guess Vim isn't optimized for the handling of 27511-character lines.
                          >>
                          >> I tried:
                          >>
                          >> :filetype indent off
                          >> ggVGgq
                          >>
                          >> (reformat the whole file). It went slowly, but after that the "temporary
                          >> hangs" disappeared completely. So I tried
                          >>
                          >> :filetype indent on
                          >> :w
                          >> :e
                          >> ggVGgq
                          >>
                          >> which added enormous lots of tabs, especially near the end. I had to undo.
                          >>
                          >> The (first) reformat apparently adds linebreaks only where there are spaces,
                          >> which isn't ideal for such an uglily-written file. I can only say that (as
                          >> someone who, 30 or 40 years ago, often had to take up COBOL programs written
                          >> by other people and make them "work right") I totally disapprove with the
                          >> "coding style" of whoever wrote that JS program.
                          >
                          >
                          > I agree, it's not the best choice for having that many characters in a line.
                          > How would I make vim break these lines up into shorter pieces so that
                          > the javascript logic doesn't break (i.e. no line breaks on words but
                          > only around ( { ) } and such signs)?
                          >
                          > Cheers,
                          > Daniel

                          maybe (untested)

                          " add space before ( [ { when preceded by non-whitespace
                          :%s/\S\zs[[({]/ \0/g
                          " add space after ) ] } ; , . when followed by non-whitespace
                          :%s/[])};,.]\ze\S/\0 /g
                          " reformat
                          :normal ggVGgq

                          I think we cannot be sure that the line will never get broken between
                          "ordinary" words, but this will increase the number of "possible line-breaking
                          positions" near punctuation.

                          The reformat operation may act differently depending on whether
                          filetype-indenting is in effect.


                          Best regards,
                          Tony.
                          --
                          hundred-and-one symptoms of being an internet addict:
                          216. Your pet rock leaves home.

                          --~--~---------~--~----~------------~-------~--~----~
                          You received this message from the "vim_use" maillist.
                          For more information, visit http://www.vim.org/maillist.php
                          -~----------~----~----~----~------~----~------~--~---
                        • Daniel Fetchinson
                          ... Thanks a lot! Doesn t quite work yet but gives me a good idea how to go along. Cheers, Daniel --~--~---------~--~----~------------~-------~--~----~ You
                          Message 12 of 13 , Jan 6, 2008
                          • 0 Attachment
                            > >> I guess Vim isn't optimized for the handling of 27511-character lines.
                            > >>
                            > >> I tried:
                            > >>
                            > >> :filetype indent off
                            > >> ggVGgq
                            > >>
                            > >> (reformat the whole file). It went slowly, but after that the "temporary
                            > >> hangs" disappeared completely. So I tried
                            > >>
                            > >> :filetype indent on
                            > >> :w
                            > >> :e
                            > >> ggVGgq
                            > >>
                            > >> which added enormous lots of tabs, especially near the end. I had to
                            > undo.
                            > >>
                            > >> The (first) reformat apparently adds linebreaks only where there are
                            > spaces,
                            > >> which isn't ideal for such an uglily-written file. I can only say that
                            > (as
                            > >> someone who, 30 or 40 years ago, often had to take up COBOL programs
                            > written
                            > >> by other people and make them "work right") I totally disapprove with the
                            > >> "coding style" of whoever wrote that JS program.
                            > >
                            > >
                            > > I agree, it's not the best choice for having that many characters in a
                            > line.
                            > > How would I make vim break these lines up into shorter pieces so that
                            > > the javascript logic doesn't break (i.e. no line breaks on words but
                            > > only around ( { ) } and such signs)?
                            > >
                            > > Cheers,
                            > > Daniel
                            >
                            > maybe (untested)
                            >
                            > " add space before ( [ { when preceded by non-whitespace
                            > :%s/\S\zs[[({]/ \0/g
                            > " add space after ) ] } ; , . when followed by non-whitespace
                            > :%s/[])};,.]\ze\S/\0 /g
                            > " reformat
                            > :normal ggVGgq
                            >
                            > I think we cannot be sure that the line will never get broken between
                            > "ordinary" words, but this will increase the number of "possible
                            > line-breaking
                            > positions" near punctuation.
                            >
                            > The reformat operation may act differently depending on whether
                            > filetype-indenting is in effect.

                            Thanks a lot! Doesn't quite work yet but gives me a good idea how to go along.

                            Cheers,
                            Daniel

                            --~--~---------~--~----~------------~-------~--~----~
                            You received this message from the "vim_use" maillist.
                            For more information, visit http://www.vim.org/maillist.php
                            -~----------~----~----~----~------~----~------~--~---
                          • sc
                            ... another way to turn it off: let g:loaded_matchparen = 1 long ago i turned that plugin off as being overly distracting and entirely unnecessary i was
                            Message 13 of 13 , Jan 6, 2008
                            • 0 Attachment
                              On Sunday 06 January 2008 02:51, Ben Schmidt wrote:
                              > Daniel Fetchinson wrote:
                              > >>> I've upgraded to vim 7 recently and to my biggest
                              > >>> surprise I've noticed that this most recent version of
                              > >>> vim chokes on a simple text file (it's javascript
                              > >>> source for the ext.js javascript library):
                              > >>> http://extjs.com/deploy/dev/adapter/ext/ext-base.js
                              > >>>
                              > >>> The file is small the only peculiarity is that it has 2
                              > >>> very long lines. I always liked vim because it was the
                              > >>> most robust editor out there but I'm not really sure
                              > >>> why this simple text file is giving it such a hard
                              > >>> time. I renamed it to something else so the javascript
                              > >>> syntax highlighting doesn't kick in and still CPU usage
                              > >>> shoots up to 100% when I'm moving around the file.
                              >
                              > I think with A. Politz that it's Matchparen, as when my Vim
                              > slows down while navigating the file and I do Ctrl-C I get
                              > told that Highlight_Matching_Pair (or similar) is being
                              > interrupted.
                              >
                              > :NoMatchParen
                              >
                              > fixes it for me, and I expect will for you, too, if that is
                              > indeed the problem.

                              another way to turn it off:

                              let g:loaded_matchparen = 1

                              long ago i turned that plugin off as being overly distracting
                              and entirely unnecessary

                              i was wondering why everyone else was having troubles with
                              that file :)

                              sc


                              > Ben.
                              >
                              >
                              >
                              >
                              > Send instant messages to your online friends
                              > http://au.messenger.yahoo.com
                              >
                              >
                              >

                              --~--~---------~--~----~------------~-------~--~----~
                              You received this message from the "vim_use" maillist.
                              For more information, visit http://www.vim.org/maillist.php
                              -~----------~----~----~----~------~----~------~--~---
                            Your message has been successfully submitted and would be delivered to recipients shortly.