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

open files on vim VimEnter event not load syntax for each buffer

Expand Messages
  • dsfdfsf
    Hello I have write plugin which remember not closed buffers on exit and restore them on VimEnter event (http://www.vim.org/scripts/script.php? script_id=2733).
    Message 1 of 3 , Aug 9, 2009
    • 0 Attachment
      Hello

      I have write plugin which remember not closed buffers on exit and
      restore them on VimEnter event (http://www.vim.org/scripts/script.php?
      script_id=2733).
      There is problem, all opened buffers on VimEnter event have no syntax
      (syntax=[Empty]).
      I have add string, which check extension and set syntax=[Ext], but,
      how i can see in filetype.vim, there is many alias, it's mean if I set
      alias, no highlight set. I can duplicate rules of filetype.vim and
      check set ext by alias which follow on original extension, but it will
      be grand part of duplicate code , maybe there is way to do it more
      pure without dirty hacks ? :)
      Maybe i can call filetype.vim more early or something like that or
      there is way to set syntax by another way or there is event on which
      it would open buffers with syntax highlight?

      Help me fellows!



      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_dev" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Michal Kurgan
      On Sun, 9 Aug 2009 12:42:52 -0700 (PDT) ... I may be wrong but i think it is because autocommands are not recursive to prevent infinite chains of events. You
      Message 2 of 3 , Aug 9, 2009
      • 0 Attachment
        On Sun, 9 Aug 2009 12:42:52 -0700 (PDT)
        dsfdfsf <ppdlive@...> wrote:

        > There is problem, all opened buffers on VimEnter event have no syntax
        > (syntax=[Empty]).
        >
        > [ ... ]
        >
        > Help me fellows!
        >

        I may be wrong but i think it is because autocommands are not recursive to
        prevent infinite chains of events. You can override this behaviour with
        nested specifier.

        :help autocmd
        :help autocmd-nested

        e.g.
        autocmd VimEnter * nested call s:LoadBuffers()

        Hope this helps.

        --
        Michal Kurgan



        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_dev" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      • Sergey Vakulenko
        That is it, thanks a lot! ... --~--~---------~--~----~------------~-------~--~----~ You received this message from the vim_dev maillist. For more
        Message 3 of 3 , Aug 10, 2009
        • 0 Attachment
          That is it, thanks a lot!

          2009/8/10, Michal Kurgan <michal.kurgan@...>:
          >
          > On Sun, 9 Aug 2009 12:42:52 -0700 (PDT)
          > dsfdfsf <ppdlive@...> wrote:
          >
          >> There is problem, all opened buffers on VimEnter event have no syntax
          >> (syntax=[Empty]).
          >>
          >> [ ... ]
          >>
          >> Help me fellows!
          >>
          >
          > I may be wrong but i think it is because autocommands are not recursive to
          > prevent infinite chains of events. You can override this behaviour with
          > nested specifier.
          >
          > :help autocmd
          > :help autocmd-nested
          >
          > e.g.
          > autocmd VimEnter * nested call s:LoadBuffers()
          >
          > Hope this helps.
          >
          > --
          > Michal Kurgan
          >
          >
          >
          > >
          >

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