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

Problem with synIDattr()

Expand Messages
  • Christian Brabandt
    Hi, I recently noticed, that there are some problems with synIDattr()น: 1) the standout highlighting attribute is not mentioned at the help file or at least
    Message 1 of 3 , Mar 2, 2010
    • 0 Attachment
      Hi,

      I recently noticed, that there are some problems with synIDattr()น:

      1) the standout highlighting attribute is not mentioned at the help
      file or at least not at :h synIDattr()

      2) you cannot query the font attribute, although you can set it.
      I think this should be possible, since you can set it.

      3) synIDattr() returns sometimes incorrect values. Try
      gvim -u NONE -c "echo synIDattr(synIDtrans(hlID('Normal')), 'fg',
      'cterm')"
      This will return -1 though it should probably return an empty string,
      I guess.

      Attached patch fixes these problems (also available at
      http://www.256bit.org/~chrisbra/patches/syIDattr.patch). You can now
      query the font attribute using
      gvim -u NONE -c "echo synIDattr(synIDtrans(hlID('Normal')), 'font')"

      The usual disclaimer applies though: My C-Skills are rusty, so please
      review carefully. I have tested this patch and it works for me on
      Windows and Linux.

      (BTW: could it be possible to have synIDattr() return a dictionary with
      all available attributes for a highlighting group? It is very clumsy to
      save the hi output without falling back to redir | hi in order to
      restore it later.)


      น) see this recent thread at vim_use:
      http://groups.google.com/group/vim_use/browse_frm/thread/68373b7463ef2099#

      regards,
      Christian
      --

      --
      You received this message from the "vim_dev" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    • Christian Brabandt
      ... Grml, I guess, I just found a bug in my Checkattach plugin (http://www.vim.org/scripts/script.php?script_id=2796). Well, here is the patch and the plugin
      Message 2 of 3 , Mar 2, 2010
      • 0 Attachment
        On Di, 02 Mär 2010, Christian Brabandt wrote:

        > Attached patch fixes these problems (also available at
        > http://www.256bit.org/~chrisbra/patches/syIDattr.patch). You can now
        > query the font attribute using
        > gvim -u NONE -c "echo synIDattr(synIDtrans(hlID('Normal')), 'font')"

        Grml, I guess, I just found a bug in my Checkattach plugin
        (http://www.vim.org/scripts/script.php?script_id=2796). Well, here is
        the patch and the plugin is fixed as well.

        regards,
        Christian

        --
        You received this message from the "vim_dev" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php
      • Bram Moolenaar
        ... Thanks, I ll look into it soon. -- I have to exercise early in the morning before my brain figures out what I m doing. /// Bram Moolenaar --
        Message 3 of 3 , Mar 3, 2010
        • 0 Attachment
          Christian Brabandt wrote:

          > On Di, 02 Mär 2010, Christian Brabandt wrote:
          >
          > > Attached patch fixes these problems (also available at
          > > http://www.256bit.org/~chrisbra/patches/syIDattr.patch). You can now
          > > query the font attribute using
          > > gvim -u NONE -c "echo synIDattr(synIDtrans(hlID('Normal')), 'font')"
          >
          > Grml, I guess, I just found a bug in my Checkattach plugin
          > (http://www.vim.org/scripts/script.php?script_id=2796). Well, here is
          > the patch and the plugin is fixed as well.

          Thanks, I'll look into it soon.

          --
          I have to exercise early in the morning before my brain
          figures out what I'm doing.

          /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
          /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
          \\\ download, build and distribute -- http://www.A-A-P.org ///
          \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

          --
          You received this message from the "vim_dev" maillist.
          Do not top-post! Type your reply below the text you are replying to.
          For more information, visit http://www.vim.org/maillist.php
        Your message has been successfully submitted and would be delivered to recipients shortly.