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

Question on highlighting

Expand Messages
  • Sean Hubbell
    Hello, I would like to be able to shade (use the same background color, but make it lighter) the text between two braces (spanning multiple lines and possibly
    Message 1 of 6 , Feb 1, 2007
    • 0 Attachment
      Hello,

      I would like to be able to shade (use the same background color, but
      make it lighter) the text between two braces (spanning multiple lines
      and possibly nested). What is the best way to accomplish this?

      Thanks in advance,

      Sean
    • DervishD
      Hi Sean :) ... If you re already using a syntax file (e.g. the vim runtime provides a syntax file for the language you re interested in), you may dare to
      Message 2 of 6 , Feb 4, 2007
      • 0 Attachment
        Hi Sean :)

        * Sean Hubbell <shubbell@...> dixit:
        > I would like to be able to shade (use the same background color, but
        > make it lighter) the text between two braces (spanning multiple lines
        > and possibly nested). What is the best way to accomplish this?

        If you're already using a syntax file (e.g. the vim runtime provides
        a syntax file for the language you're interested in), you may dare to
        modify it, or to write your own modifications in some "~/.vim/after/.*"
        syntax file.

        If exists a syntax file suitable for you in the vim runtime *and* it
        already provides some "syntax group" for the text between two braces,
        then you're lucky, because you just need to add something like:

        hi Shaded ...
        hi link NameOfTheGroup Shaded

        To know what to put in the "...", see ":help highlight".

        If you need to add your own group (or if no syntax file exists for
        that language), I think that your best bet is using a region:

        syntax region TextInBrackets start="{" end="}"
        hi TextInBrackets ...

        Again, see ":help highlight" and ":help syntax". If you could
        ellaborate a bit on your problem (language you're using, which terminal
        do you use, for example), I may give you more precise help regarding
        colors, and the like.

        I hope that helps :))))

        Raúl Núñez de Arenas Coronado

        --
        Linux Registered User 88736 | http://www.dervishd.net
        It's my PC and I'll cry if I want to... RAmen!
      • uidzer0
        Hey everyone, Currently I have auto highlighting setup for things like: hi clear fixme hi clear todo hi clear note However, I d like to add highlighting for
        Message 3 of 6 , Jun 27, 2008
        • 0 Attachment
          Hey everyone,

          Currently I have auto highlighting setup for things like:

          hi clear fixme
          hi clear todo
          hi clear note

          However, I'd like to add highlighting for common code errors like a colon
          instead of a semi-colon. I tried to do something like:

          hi clear :$

          Although I received a syntax error. Is there a way to incorporate basic
          regular expressions into the highlight syntax?

          Thanks!
          --
          View this message in context: http://www.nabble.com/Question-on-highlighting-tp18163005p18163005.html
          Sent from the Vim - General mailing list archive at Nabble.com.


          --~--~---------~--~----~------------~-------~--~----~
          You received this message from the "vim_use" maillist.
          For more information, visit http://www.vim.org/maillist.php
          -~----------~----~----~----~------~----~------~--~---
        • Tony Mechelynck
          ... The operand of :hi clear is not some text found in your editfile, it is the name of a highlight group. If you want to suppress errors the way you
          Message 4 of 6 , Jun 27, 2008
          • 0 Attachment
            On 27/06/08 22:13, uidzer0 wrote:
            >
            > Hey everyone,
            >
            > Currently I have auto highlighting setup for things like:
            >
            > hi clear fixme
            > hi clear todo
            > hi clear note
            >
            > However, I'd like to add highlighting for common code errors like a colon
            > instead of a semi-colon. I tried to do something like:
            >
            > hi clear :$
            >
            > Although I received a syntax error. Is there a way to incorporate basic
            > regular expressions into the highlight syntax?
            >
            > Thanks!

            The operand of ":hi clear" is not some text found in your editfile, it
            is the name of a highlight group. If you want to suppress errors the way
            you _suppressed_ (not _set up_) Fixme, Todo and Note highlighting, use

            :hi clear Error

            And if you want no highlighting at all, use

            :syntax off


            Best regards,
            Tony.
            --
            hundred-and-one symptoms of being an internet addict:
            28. You have comandeered your teenager's phone line for the net and even his
            friends know not to call on his line anymore.

            --~--~---------~--~----~------------~-------~--~----~
            You received this message from the "vim_use" maillist.
            For more information, visit http://www.vim.org/maillist.php
            -~----------~----~----~----~------~----~------~--~---
          • Benjamin Fritz
            ... Indeed, you probably want samething like syntax match Error :$ This would go in a file in $HOME/after/syntax for the language in question, or in an
            Message 5 of 6 , Jun 27, 2008
            • 0 Attachment
              On 6/27/08, Tony Mechelynck <antoine.mechelynck@...> wrote:
              >
              > On 27/06/08 22:13, uidzer0 wrote:
              > >
              > > Hey everyone,
              > >
              > > Currently I have auto highlighting setup for things like:
              > >
              > > hi clear fixme
              > > hi clear todo
              > > hi clear note
              > >
              > > However, I'd like to add highlighting for common code errors like a colon
              > > instead of a semi-colon. I tried to do something like:
              > >
              > > hi clear :$
              > >
              > > Although I received a syntax error. Is there a way to incorporate basic
              > > regular expressions into the highlight syntax?
              > >
              > > Thanks!
              >
              >
              > The operand of ":hi clear" is not some text found in your editfile, it
              > is the name of a highlight group. If you want to suppress errors the way
              > you _suppressed_ (not _set up_) Fixme, Todo and Note highlighting, use
              >
              > :hi clear Error
              >
              > And if you want no highlighting at all, use
              >
              > :syntax off
              >
              >
              > Best regards,
              > Tony.
              >

              Indeed, you probably want samething like

              syntax match Error ":$"

              This would go in a file in $HOME/after/syntax for the language in
              question, or in an autocmd like:

              autocmd Syntax c,cpp,java syntax match Error ":$"

              You should see :help syntax for a full discussion of this.

              Or at least look at :help :syntax, :help :syn-match, and :help :highlight

              --~--~---------~--~----~------------~-------~--~----~
              You received this message from the "vim_use" maillist.
              For more information, visit http://www.vim.org/maillist.php
              -~----------~----~----~----~------~----~------~--~---
            • uidzer0
              Makes sense - thanks guys! ... --~--~---------~--~----~------------~-------~--~----~ You received this message from the vim_use maillist. For more
              Message 6 of 6 , Jun 27, 2008
              • 0 Attachment
                Makes sense - thanks guys!

                On Jun 27, 2:42 pm, "Benjamin Fritz" <fritzophre...@...> wrote:
                > On 6/27/08, Tony Mechelynck <antoine.mechely...@...> wrote:
                >
                >
                >
                >
                >
                > >  On 27/06/08 22:13, uidzer0 wrote:
                >
                > >  > Hey everyone,
                >
                > >  > Currently I have auto highlighting setup for things like:
                >
                > >  > hi clear fixme
                > >  > hi clear todo
                > >  > hi clear note
                >
                > >  > However, I'd like to add highlighting for common code errors like a colon
                > >  > instead of a semi-colon. I tried to do something like:
                >
                > >  > hi clear :$
                >
                > >  > Although I received a syntax error. Is there a way to incorporate basic
                > >  > regular expressions into the highlight syntax?
                >
                > >  > Thanks!
                >
                > > The operand of ":hi clear" is not some text found in your editfile, it
                > >  is the name of a highlight group. If you want to suppress errors the way
                > >  you _suppressed_ (not _set up_) Fixme, Todo and Note highlighting, use
                >
                > >         :hi clear Error
                >
                > >  And if you want no highlighting at all, use
                >
                > >         :syntax off
                >
                > >  Best regards,
                > >  Tony.
                >
                > Indeed, you probably want samething like
                >
                > syntax match Error ":$"
                >
                > This would go in a file in $HOME/after/syntax for the language in
                > question, or in an autocmd like:
                >
                > autocmd Syntax c,cpp,java syntax match Error ":$"
                >
                > You should see :help syntax for a full discussion of this.
                >
                > Or at least look at :help :syntax, :help :syn-match, and :help :highlight
                --~--~---------~--~----~------------~-------~--~----~
                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.