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

How to do dynamic syntax highlighting?

Expand Messages
  • Ron Aaron
    I am wondering how one might go about adding keywords while a file is being syntax-highlighted. The idea is that at the top of a file, one defines a new
    Message 1 of 2 , Jan 21, 2008
      I am wondering how one might go about adding keywords while a file is
      being syntax-highlighted.

      The idea is that at the top of a file, one defines a new function.
      Afterwards, in that file, that function should be highlighted as
      "known".

      I realize it can be done using tags; I am looking for something more
      dynamic.
      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_dev" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • thomas
      ... I think you just have to make sure the highlighting is done after setting filetype. When reloading the syntax file, the custom highlights have to be
      Message 2 of 2 , Jan 22, 2008
        > I am wondering how one might go about adding keywords while a file is
        > being syntax-highlighted.

        I think you just have to make sure the highlighting is done after
        setting filetype. When reloading the syntax file, the custom
        highlights have to be reloaded too. I think this could best be done by
        defining a buffer-local autocommand for FileType or Syntax.

        The main problem with your approach probably is how to detect that a
        new function was defined.

        Thomas.

        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_dev" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      Your message has been successfully submitted and would be delivered to recipients shortly.