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

Re: syn question

Expand Messages
  • Johannes Zellner
    ... but it restricts me to groups which were defined to be contained in b:current_syntax. Comment -- Johannes
    Message 1 of 8 , Apr 11 6:28 AM
    • 0 Attachment
      On Tue, 11 Apr 2000, Johannes Zellner wrote:

      > On Tue, 11 Apr 2000, Stephen P. Wall wrote:
      >
      > > > From: Johannes Zellner <johannes@...>
      > > >
      > > > suppose I want to highlight a pattern (e.g. my e-mail address) in all files
      > > > of all filetypes w/o changing the original syntax files and without adding
      > > > a line in `mysyntax.vim' for each filetype.
      > >
      > > I use the following to highlight a variety of todo items:
      > >
      > > " Todo/DEBUG items in comments:
      > > autocmd BufNewFile,BufRead * if exists("b:current_syntax")
      > > autocmd BufNewFile,BufRead * exe 'syn keyword '.b:current_syntax.'Todo
      > > contained TODO FIXME XXX DEBUG Debug Todo todo ATTENTION kludge Kludge KLUDGE'
      > > autocmd BufNewFile,BufRead * exe 'syn match '.b:current_syntax.'Todo
      > > contained "!!!!*\|????*"'
      > > autocmd BufNewFile,BufRead * endif
      > not bad. I'll try this. thanks.

      but it restricts me to groups which were defined
      to be contained in b:current_syntax.'Comment'

      --
      Johannes
    • Stephen P. Wall
      ... Yes. Almost half of the syntax files include a Todo item. And as I said, it will only be in comments. Maybe you could implement a new syntax keyword,
      Message 2 of 8 , Apr 11 7:27 AM
      • 0 Attachment
        > From: Johannes Zellner <johannes@...>
        >
        > but it restricts me to groups which were defined
        > to be contained in b:current_syntax.'Comment'
        >

        Yes. Almost half of the syntax files include a Todo item.
        And as I said, it will only be in comments. Maybe you could implement
        a new syntax keyword, "containedall":

        syntax match eMail "johannes@..." containedall

        Would force eMail to be contained by all other syntax groups, whether
        they have a "contains=" option or not. Don't know if Bram would
        want to include such a thing - it's use it quite narrow. Would there
        be a more general way to implement something like this?

        syntax match eMail "johannes@..." supercedes=@ALL

        with "supercedes" being a list of syntax items which this item will
        supercede, even if the other syntax has already started. problems -
        should the superceded syntax resume after the superceding one ends,
        or should it just be ended, or should the code track both syntaxes
        simultaneously, and "do the right thing"? Could get quite complicated,
        multiple "supercedes" could result in tracking several syntaxes
        simultaneously. Could restrict to only one supercede active at a time,
        ie, you cannot supercede a syntax item that has the "supercede" option.
        Again, though, are there enough practical applications of such an item
        to make implementation worthwhile?

        --
        Free High Speed DSL Access:
        http://in.winfire.com/s/isapiEng.dll/wf.exe?cmd=rl&452,180045277&wf.exe
        ______________________________________________________________________
        ________ ______
        Stephen P. Wall Redcom Laboratories, Inc. / __ /\/ ___/\
        Steve_Wall@... One Redcom Center ___/ /\/ /_/ /\__\/
        (716) 924-7550 Victor, NY 14564 /_____/ /_______/ /
        x300 USA \_____\/\_______\/
      • Bram Moolenaar
        ... Hmm, would be possible. Since it would also match when it s not contained in anything, containedall isn t fully correct. We could call it anywhere
        Message 3 of 8 , Apr 12 8:16 AM
        • 0 Attachment
          Stephen P. Wall wrote:

          > Maybe you could implement a new syntax keyword, "containedall":
          >
          > syntax match eMail "johannes@..." containedall

          Hmm, would be possible. Since it would also match when it's not contained in
          anything, "containedall" isn't fully correct. We could call it "anywhere"
          perhaps.

          > Would force eMail to be contained by all other syntax groups, whether
          > they have a "contains=" option or not. Don't know if Bram would
          > want to include such a thing - it's use it quite narrow. Would there
          > be a more general way to implement something like this?
          >
          > syntax match eMail "johannes@..." supercedes=@ALL
          >
          > with "supercedes" being a list of syntax items which this item will
          > supercede, even if the other syntax has already started. problems -
          > should the superceded syntax resume after the superceding one ends,
          > or should it just be ended, or should the code track both syntaxes
          > simultaneously, and "do the right thing"? Could get quite complicated,
          > multiple "supercedes" could result in tracking several syntaxes
          > simultaneously. Could restrict to only one supercede active at a time,
          > ie, you cannot supercede a syntax item that has the "supercede" option.
          > Again, though, are there enough practical applications of such an item
          > to make implementation worthwhile?

          This sounds complicated. Do we really need this? Implementing the "anywhere"
          is much easier.

          Another item that would be nice, but might not be needed, is "containedin=",
          giving a list of items this item can be contained in, even though those items
          don't have this item in their "contains=" list.

          --
          hundred-and-one symptoms of being an internet addict:
          3. Your bookmark takes 15 minutes to scroll from top to bottom.

          /-/-- Bram Moolenaar --- Bram@... --- http://www.moolenaar.net --\-\
          \-\-- Vim: http://www.vim.org ---- ICCF Holland: http://www.vim.org/iccf --/-/
        • Stephen P. Wall
          ... Or everywhere . Hey, a religious war! 8-] ... Not quite that bad... 8-] They re mostly useless, anyways. Some are so old, I don t even know if they
          Message 4 of 8 , Apr 12 11:19 AM
          • 0 Attachment
            > From: Bram Moolenaar <Bram@...>
            >
            > Hmm, would be possible. Since it would also match when it's not contained in
            > anything, "containedall" isn't fully correct. We could call it "anywhere"
            > perhaps.
            >

            Or "everywhere". Hey, a religious war! 8-]


            > 3. Your bookmark takes 15 minutes to scroll from top to bottom.

            Not quite that bad... 8-] They're mostly useless, anyways. Some
            are so old, I don't even know if they still work. A bunch were put
            there by the browser and I don't even know what they are. Somebody
            should invent a better way to organize and track them. How about
            a vim script? =-) Hey, if vim could display images and access
            HTTP servers, it could even fetch the links and display them for
            you... Netscape's new Gecko engine is supposed to be embeddable...

            --
            Free High Speed DSL Access:
            http://in.winfire.com/s/isapiEng.dll/wf.exe?cmd=rl&452,180045277&wf.exe
            ______________________________________________________________________
            ________ ______
            Stephen P. Wall Redcom Laboratories, Inc. / __ /\/ ___/\
            Steve_Wall@... One Redcom Center ___/ /\/ /_/ /\__\/
            (716) 924-7550 Victor, NY 14564 /_____/ /_______/ /
            x300 USA \_____\/\_______\/
          • Thomas Köhler
            On Wed, Apr 12, 2000 at 08:24:50PM +0200, ... [...] ... Well, as I m currently struggling to get my bookmarks database (it s really a database, mySQL-based)
            Message 5 of 8 , Apr 12 11:40 AM
            • 0 Attachment
              On Wed, Apr 12, 2000 at 08:24:50PM +0200,
              Stephen P. Wall <swall@...> wrote:
              >
              [...]
              > > 3. Your bookmark takes 15 minutes to scroll from top to bottom.
              >
              > Not quite that bad... 8-] They're mostly useless, anyways. Some
              > are so old, I don't even know if they still work. A bunch were put
              > there by the browser and I don't even know what they are. Somebody
              > should invent a better way to organize and track them. How about
              > a vim script? =-) Hey, if vim could display images and access
              > HTTP servers, it could even fetch the links and display them for
              > you... Netscape's new Gecko engine is supposed to be embeddable...

              Well, as I'm currently struggling to get my bookmarks database (it's
              really a database, mySQL-based) work better, I might as well come up
              with a few cool vim macros to add or delete URLs - Is there a way to let
              vim connect to mysql? :-}

              (OK, the idea would be to do some "mysqldump" of all the URLs, put those
              in a file, edit that file, and on :w, just put the data back in tha
              database)

              OK, now this one gets too silly I think...

              CU,
              Thomas

              --
              Thomas Köhler Email: jean-luc@... | LCARS - Linux
              <>< WWW: http://jeanluc-picard.de | for Computers
              IRC: jeanluc | on All Real
              PGP public key available from Homepage! | Starships
            Your message has been successfully submitted and would be delivered to recipients shortly.