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

Re: Reduced functionality (FASTER) xml syntax file?

Expand Messages
  • John Orr
    Thanks David, an innovative solution. I m not quite sure what I m doing wrong but the function isn t doing anything for me though. It prints out a decrementing
    Message 1 of 8 , Dec 1, 2008
    View Source
    • 0 Attachment
      Thanks David, an innovative solution.
      I'm not quite sure what I'm doing wrong but the function isn't doing
      anything for me though.
      It prints out a decrementing status of how many lines are left to format,
      so it seems to be working, but nothing gets formatted.
      I suspected it was because I had tw=0 but setting it to 60 didn't help.

      Any easy ideas? Otherwise, the synmaxcol suggestion may well be
      sufficient.

      (I could send you debug output - scriptnames, or other things - but I
      don't want to waste you time unless you're keen.)

      Thanks very much anyway,
      John


      On Tue, 02 Dec 2008 06:44:33 +1100, David Fishburn
      <dfishburn.vim@...> wrote:

      >
      > This is a simple work around that seems to keep things moving for me.
      > I define the following in my vimrc.
      >
      > function! Format_SGML() range
      > " Add a new line to the bottom of the mark to be removed later
      > call cursor(a:lastline,1)
      > put =''
      > silent! exec "ma z"
      > " Add a new line above the mark to be removed later
      > call cursor(a:firstline,1)
      > put! = ''
      > silent! exec "ma y"
      >
      > " Record current filetype
      > let save_ft = &filetype
      >
      > if save_ft != 'xml'
      > " Change the filetype so we can format the selection
      > setlocal filetype=xml
      > endif
      >
      > " Put each tag on a newline
      > exec line("'y").','.line("'z").'s/>\s*</>\r</ge'
      > " Reformat using Vim's indenter
      > call cursor(line("'y"),1)
      > exec 'normal! '.(line("'z")-line("'y")+1).'=='
      >
      > if save_ft != 'xml'
      > " Restore the filetype
      > exec 'setlocal filetype='.save_ft
      > endif
      >
      > " Delete the additional lines added
      > silent! exe "norm! 'ydd'zdd"
      > endfunction
      > command! -range=% -nargs=0 FormatSGML <line1>,<line2>call Format_SGML()
      >
      > Then each time I open the file I run:
      > :FormatSGML
      >
      > It seems when the lines are shorter, the highlighting is quick.
      >
      > HTH,
      > Dave
      >
      >
      > On 12/1/08, Gene Kwiecinski <gkwiecinski@...> wrote:
      >>
      >>> was so slow. Disabling syntax highlighting proved to solve the problem
      >> -
      >>> but I was wondering, has anyone else hit this problem, and perhaps
      >> created
      >>> a reduced functionality xml syntax highlighter - so I still get
      >> something
      >>> useful, but maybe not quite as complex?
      >>
      >> One person's opinion of what constitutes "stripped down" would likely
      >> differ from someone else's opinion, which is the problem. Eg, you might
      >> be happy with just tagstoff being one color, and textstoff being a
      >> different color. Someone else might want attributes to be a 3rd color.
      >> Someone else would make comments a different color. Before you know it,
      >> you'd have a "stripped down" syntax file that's maybe 80% of the
      >> original, not saving much.
      >>
      >> <shrug/>
      >>
      >> >
      >>
      >
      > >


      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • John Orr
      Thanks very much Erik, that seems to work very well and is probably a good trade-off. John ... --~--~---------~--~----~------------~-------~--~----~ You
      Message 2 of 8 , Dec 1, 2008
      View Source
      • 0 Attachment
        Thanks very much Erik, that seems to work very well and is probably a good
        trade-off.

        John

        On Tue, 02 Dec 2008 06:45:55 +1100, Erik Falor <ewfalor@...> wrote:

        >
        > On Tue, Dec 02, 2008 at 05:44:03AM +1100, John Orr wrote:
        >> has anyone else hit this problem, and perhaps created
        >> a reduced functionality xml syntax highlighter - so I still get
        >> something
        >> useful, but maybe not quite as complex?
        >>
        >
        > I personally run into this most frequently when editing an XML file
        > with really long lines.
        >
        > I just adjust 'synmaxcol' to something like 128 and Vim speeds right
        > back up. The trade-off being that only the first 128 characters in a
        > line are highlighted.
        >
        > Read
        > :help 'synmaxcol'
        > for more info.
        >


        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_use" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      • John Orr
        I may have worked out the problem, perhaps - and it s the xml files I m looking at. The dtd/schema is poor - with lots of attributes which should be elements -
        Message 3 of 8 , Dec 1, 2008
        View Source
        • 0 Attachment
          I may have worked out the problem, perhaps - and it's the xml files I'm
          looking at.

          The dtd/schema is poor - with lots of attributes which should be elements
          - so each element gets very long, and perhaps Vim keeps it together??

          Anyway - synmaxcol is working well.

          Thanks,
          John

          On Tue, 02 Dec 2008 07:12:35 +1100, John Orr <johno@...>
          wrote:

          >
          > Thanks David, an innovative solution.
          > I'm not quite sure what I'm doing wrong but the function isn't doing
          > anything for me though.
          > It prints out a decrementing status of how many lines are left to format,
          > so it seems to be working, but nothing gets formatted.
          > I suspected it was because I had tw=0 but setting it to 60 didn't help.
          >
          > Any easy ideas? Otherwise, the synmaxcol suggestion may well be
          > sufficient.
          >
          > (I could send you debug output - scriptnames, or other things - but I
          > don't want to waste you time unless you're keen.)
          >
          > Thanks very much anyway,
          > John
          >
          >
          > On Tue, 02 Dec 2008 06:44:33 +1100, David Fishburn
          > <dfishburn.vim@...> wrote:
          >
          >>
          >> This is a simple work around that seems to keep things moving for me.
          >> I define the following in my vimrc.
          >>
          >> function! Format_SGML() range
          >> " Add a new line to the bottom of the mark to be removed later
          >> call cursor(a:lastline,1)
          >> put =''
          >> silent! exec "ma z"
          >> " Add a new line above the mark to be removed later
          >> call cursor(a:firstline,1)
          >> put! = ''
          >> silent! exec "ma y"
          >>
          >> " Record current filetype
          >> let save_ft = &filetype
          >>
          >> if save_ft != 'xml'
          >> " Change the filetype so we can format the selection
          >> setlocal filetype=xml
          >> endif
          >>
          >> " Put each tag on a newline
          >> exec line("'y").','.line("'z").'s/>\s*</>\r</ge'
          >> " Reformat using Vim's indenter
          >> call cursor(line("'y"),1)
          >> exec 'normal! '.(line("'z")-line("'y")+1).'=='
          >>
          >> if save_ft != 'xml'
          >> " Restore the filetype
          >> exec 'setlocal filetype='.save_ft
          >> endif
          >>
          >> " Delete the additional lines added
          >> silent! exe "norm! 'ydd'zdd"
          >> endfunction
          >> command! -range=% -nargs=0 FormatSGML <line1>,<line2>call Format_SGML()
          >>
          >> Then each time I open the file I run:
          >> :FormatSGML
          >>
          >> It seems when the lines are shorter, the highlighting is quick.
          >>
          >> HTH,
          >> Dave
          >>
          >>
          >> On 12/1/08, Gene Kwiecinski <gkwiecinski@...> wrote:
          >>>
          >>>> was so slow. Disabling syntax highlighting proved to solve the
          >>>> problem
          >>> -
          >>>> but I was wondering, has anyone else hit this problem, and perhaps
          >>> created
          >>>> a reduced functionality xml syntax highlighter - so I still get
          >>> something
          >>>> useful, but maybe not quite as complex?
          >>>
          >>> One person's opinion of what constitutes "stripped down" would likely
          >>> differ from someone else's opinion, which is the problem. Eg, you
          >>> might
          >>> be happy with just tagstoff being one color, and textstoff being a
          >>> different color. Someone else might want attributes to be a 3rd color.
          >>> Someone else would make comments a different color. Before you know
          >>> it,
          >>> you'd have a "stripped down" syntax file that's maybe 80% of the
          >>> original, not saving much.
          >>>
          >>> <shrug/>
          >>>
          >>> >
          >>>
          >>
          >> >
          >
          >
          > >



          --~--~---------~--~----~------------~-------~--~----~
          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.