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

Re: collapsing single lines of html tag attributes via plugin??

Expand Messages
  • Tobia
    ... There is a simple solution, maybe too simple, but... if you only have one tag per line, or if you can reformat your file in such a way, it ... Type that
    Message 1 of 7 , Jun 1 1:21 PM
    • 0 Attachment
      Howard Glynn wrote:
      > In essence I would like to collapse huge (single) lines of tags to
      > something like <a id="xyz" href="/img .......

      There is a simple solution, maybe too simple, but... if you only have
      one tag per line, or if you can reformat your file in such a way, it
      might be enough to disable line wrap:

      :set nowrap

      You can map a function key to toggling line wrap:

      :map <F9> :set wrap!<CR>

      Type that literally, with < > and everything, or put it into ~/.vimrc


      HTH
      Tobia
    • Charles E Campbell Jr
      ... Hello! Sounds like Vince Negri s conceal patch to vim would come in handy for this. Vim s current folding is on a line-by-line basis; Negri s patch can
      Message 2 of 7 , Jun 1 2:07 PM
      • 0 Attachment
        Howard Glynn wrote:

        > <snip>
        >
        > I wondered whether there was a plugin somewhere that was able to
        > abbreviate or
        > partially hide the detail so i can see the overall structure more
        > clearly. In essence I
        > would like to collapse huge (single) lines of tags to something like
        > <a id="xyz"
        > href="/img ....... - where "...." implies I could expand if required.
        > I'm sure it is probably
        > possible to craft a plugin to do this, i just have some urgent
        > deadlines right now ;)
        > <snip>


        Hello!

        Sounds like Vince Negri's conceal patch to vim would come in handy for this.
        Vim's current folding is on a line-by-line basis; Negri's patch can also
        perform
        concealing in lines.

        You can get his patch at: http://vince.negri.googlepages.com/

        Here's an example, although it may conceal more than what you've
        requested...

        if has("conceal")
        if &conc == 0
        let &conc= 3
        endif
        syn clear
        syn region htmlTag conceal start="<" end=">"
        endif

        So this will conceal anything between <...> . One neat thing; even
        though I've
        selected conceal level 3, nonetheless, when your cursor is atop a line
        that line
        will *not* be concealed. So editing may proceed, as that's what Vim's for.

        A more comprehensive (but not html-related) example of concealing is
        available
        at my website: see AnsiEsc.vim. This plugin will conceal ansi escape
        codes and
        perform proper colorizing of the text based on the concealed ansi codes.

        Vince N has a tex.vim syntax using concealment, too, somewhere...

        BTW, folks -- if more people than H Glynn would want this -- let Bram
        know! He's under
        the impression that its not wanted very much, which is why I presume its
        not in vim 7.x.

        Vince's patch also supports "ownsyntax". Read about it at his website.

        Regards,
        Chip Campbell
      • fREW
        ... I would use conceal if it were in standard vim. Definitely. -- -fREW
        Message 3 of 7 , Jun 1 2:25 PM
        • 0 Attachment
          On 6/1/07, Charles E Campbell Jr <drchip@...> wrote:
          > Howard Glynn wrote:
          >
          > > <snip>
          > >
          > > I wondered whether there was a plugin somewhere that was able to
          > > abbreviate or
          > > partially hide the detail so i can see the overall structure more
          > > clearly. In essence I
          > > would like to collapse huge (single) lines of tags to something like
          > > <a id="xyz"
          > > href="/img ....... - where "...." implies I could expand if required.
          > > I'm sure it is probably
          > > possible to craft a plugin to do this, i just have some urgent
          > > deadlines right now ;)
          > > <snip>
          >
          >
          > Hello!
          >
          > Sounds like Vince Negri's conceal patch to vim would come in handy for this.
          > Vim's current folding is on a line-by-line basis; Negri's patch can also
          > perform
          > concealing in lines.
          >
          > You can get his patch at: http://vince.negri.googlepages.com/
          >
          > Here's an example, although it may conceal more than what you've
          > requested...
          >
          > if has("conceal")
          > if &conc == 0
          > let &conc= 3
          > endif
          > syn clear
          > syn region htmlTag conceal start="<" end=">"
          > endif
          >
          > So this will conceal anything between <...> . One neat thing; even
          > though I've
          > selected conceal level 3, nonetheless, when your cursor is atop a line
          > that line
          > will *not* be concealed. So editing may proceed, as that's what Vim's for.
          >
          > A more comprehensive (but not html-related) example of concealing is
          > available
          > at my website: see AnsiEsc.vim. This plugin will conceal ansi escape
          > codes and
          > perform proper colorizing of the text based on the concealed ansi codes.
          >
          > Vince N has a tex.vim syntax using concealment, too, somewhere...
          >
          > BTW, folks -- if more people than H Glynn would want this -- let Bram
          > know! He's under
          > the impression that its not wanted very much, which is why I presume its
          > not in vim 7.x.
          >
          > Vince's patch also supports "ownsyntax". Read about it at his website.
          >
          > Regards,
          > Chip Campbell
          >
          >

          I would use conceal if it were in standard vim. Definitely.

          --
          -fREW
        • Matthew Winn
          ... [snip] ... So would I. It s only nervousness at using unofficial patches that puts me off. I d also be interested in a view-only mode that conceals
          Message 4 of 7 , Jun 2 1:35 AM
          • 0 Attachment
            On Fri, 1 Jun 2007 15:25:25 -0600, fREW <frioux@...> wrote:

            > On 6/1/07, Charles E Campbell Jr <drchip@...> wrote:
            > > Sounds like Vince Negri's conceal patch to vim would come in handy for this.
            [snip]
            > I would use conceal if it were in standard vim. Definitely.

            So would I. It's only nervousness at using unofficial patches that
            puts me off. I'd also be interested in a view-only mode that conceals
            characters in the current line as well, if that's possible. (I have
            some large report files for which I use Vim to colour the text for
            easy reading, but that means some space in the file is taken up with
            marker characters to trigger the highlighting. It'd be nice to be able
            to collapse all the markers.)

            --
            Matthew Winn
          • Howard Glynn
            Thanks to those taking the time to post some responses on this question. I found Tobia s suggestion to map a wrapping toggle onto a function key extremely
            Message 5 of 7 , Jun 4 7:41 AM
            • 0 Attachment
              Thanks to those taking the time to post some responses on this question.

              I found Tobia's suggestion to map a wrapping toggle onto a function key
              extremely helpful - thanks, i'm using it now. Sometimes the simple ones
              are the best :-)

              I've also investigating folding a bit more thoroughly in the vim context and
              that has helped too.

              Conceal sounds like a good patch I will look into that when my deadlines
              get a bit easier, I don't really want to start trying to break my environment
              or getting distracted recompiling at this point, maybe in a few weeks.

              Cheers, Howard
            Your message has been successfully submitted and would be delivered to recipients shortly.