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

Re: highlighting text between marks

Expand Messages
  • googler
    ... Hi, thanks for the reply. It did answer my question, but on second thoughts, I would actually like to use the line number and column number corresponding
    Message 1 of 7 , Aug 1, 2009
    • 0 Attachment
      On Aug 1, 6:46 am, Teemu Likonen <tliko...@...> wrote:
      > On 2009-08-01 00:25 (-0700), googler wrote:
      >
      > > I have two marks, say a and b. I want to highlight the text between
      > > (and including) a and b. I tried to use the match command like this
      > > :'a,'b match MyGrp /.*/
      >
      > Try this first:
      >
      >     :help /\%'m
      >
      > For example:
      >
      >     :match ErrorMsg /\%'a\_.*\%'b/

      Hi, thanks for the reply. It did answer my question, but on second
      thoughts, I would actually like to use the line number and column
      number corresponding to each mark inside the ':match' command. So my
      question is, given a mark (say `a, '<, etc), is it possible to get its
      line number and column number? I have to do this because the marks I
      use to define a match earlier might get redefined, in which case those
      highlights will be gone.

      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Stahlman Family
      googler wrote: ... You might have a look at the Txtfmt plugin: http://www.vim.org/scripts/script.php?script_id=2208 http://www.freewebs.com/txtfmt It s a
      Message 2 of 7 , Aug 2, 2009
      • 0 Attachment
        googler wrote:
        ...snip...
        >
        > BTW, does any plugin exist where I can select a part of text in visual
        > mode (say using the mouse) and pressing some specific key will
        > highlight this text?

        You might have a look at the Txtfmt plugin:

        http://www.vim.org/scripts/script.php?script_id=2208
        http://www.freewebs.com/txtfmt

        It's a token-based highlighter, which allows you to highlight ranges of
        text with (configurable) colors and format attributes (e.g., bold,
        italic, underline, etc...). Version 2.0 (coming soon) supports
        background colors as well. There is a rich set of mappings for working
        with (e.g., inserting, jumping to, etc...) the tokens that begin and end
        regions. These tokens are hidden as whitespace. Version 2.0 also
        supports Vince Negri's 'conceal' patch, which permits the tokens to be
        hidden completely (i.e., made to occupy zero-width).

        Visual mode maps have not yet been implemented, but are in the todo list...

        Brett Stahlman

        >
        > Thanks.
        >
        > >
        >

        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_use" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      • Tony Mechelynck
        ... However, be aware that those functions give the position at the time they are invoked. If you add or remove text before where the mark used to be, the line
        Message 3 of 7 , Aug 14, 2009
        • 0 Attachment
          On 01/08/09 22:09, googler wrote:
          >
          >
          >
          > On Aug 1, 6:46 am, Teemu Likonen<tliko...@...> wrote:
          >> On 2009-08-01 00:25 (-0700), googler wrote:
          >>
          >>> I have two marks, say a and b. I want to highlight the text between
          >>> (and including) a and b. I tried to use the match command like this
          >>> :'a,'b match MyGrp /.*/
          >>
          >> Try this first:
          >>
          >> :help /\%'m
          >>
          >> For example:
          >>
          >> :match ErrorMsg /\%'a\_.*\%'b/
          >
          > Hi, thanks for the reply. It did answer my question, but on second
          > thoughts, I would actually like to use the line number and column
          > number corresponding to each mark inside the ':match' command. So my
          > question is, given a mark (say `a, '<, etc), is it possible to get its
          > line number and column number? I have to do this because the marks I
          > use to define a match earlier might get redefined, in which case those
          > highlights will be gone.

          See:
          :help line()
          :help col()
          :help virtcol()

          However, be aware that those functions give the position at the time
          they are invoked. If you add or remove text before where the mark used
          to be, the line & column numbers will become inexact. OTOH, as long as
          you don't use the same mark for something else, it will "move" with its
          text and remain correct even if you do some edit before the mark's position.


          Best regards,
          Tony.
          --
          "I'm fed up to the ears with old men dreaming up wars for young men to
          die in."
          -- George McGovern

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