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

loosing highlighting and more ....

Expand Messages
  • Zdenek Sekera
    I am hopelessely struggling with the following, convinced it s my problem somewhere but can t find out where. I managed to reduce the problem into a trivial
    Message 1 of 3 , Feb 2 6:41 AM
    • 0 Attachment
      I am hopelessely struggling with the following, convinced it's
      my problem somewhere but can't find out where. I managed to
      reduce the problem into a trivial case and still don't see it
      (coffee doesn't help anymore...;-(

      augroup vimdebug
      au!
      " autocmd BufRead *.vim :call Snu()
      " autocmd BufWrite *.vim :call DelSnu()
      autocmd BufRead *.vim :%s/^/111 /
      autocmd BufWrite *.vim :%s/^....//
      autocmd BufWritePost *.vim :e <afile>
      augroup END


      The idea is this: when I enter a buffer (:e%, :e a.vim and similar) I
      want
      that buffer be preprocessed before vim presents it to me.

      I simulate that by the non-commented out BufRead, that just adds '111 '
      before the first column. This works without a problem.

      When I write the file, I want:
      - before it is written, process it and write the modified file.
      I simulate this by the non-commented BufWrite which deletes first 4
      chars
      on the line. This works.

      - when the file is written, I want it to be automatically reloaded and
      be
      preprocessed by the BufRead autocmd, so I defined that BufWritePost
      hoping
      that's the way to do it.

      Well when I do :w, I can see it writing the file (it's correct) I can
      see it
      being read back, but

      - it isn't processed by the BufRead contrary to my intentions
      - the resulting file has no highlighting (no colors), though ft=vim and
      filetype=on when I check.

      If I use

      autocmd BufWritePost *.vim :e <afile> | :%s/^111 //

      this gives me correct file contents but still no highlighting.

      Where is the frog?

      ---Zdenek
    • Benji Fisher
      ... [snip] ... --Benji Fisher
      Message 2 of 3 , Feb 2 7:24 AM
      • 0 Attachment
        Zdenek Sekera wrote:
        >
        > I am hopelessely struggling with the following, convinced it's
        > my problem somewhere but can't find out where. I managed to
        > reduce the problem into a trivial case and still don't see it
        > (coffee doesn't help anymore...;-(
        >
        > augroup vimdebug
        > au!
        > " autocmd BufRead *.vim :call Snu()
        > " autocmd BufWrite *.vim :call DelSnu()
        > autocmd BufRead *.vim :%s/^/111 /
        > autocmd BufWrite *.vim :%s/^....//
        > autocmd BufWritePost *.vim :e <afile>
        > augroup END
        [snip]

        :help nested
        :get sleep ;)

        --Benji Fisher
      • Zdenek Sekera
        ... That was it! ... How I can :-)
        Message 3 of 3 , Feb 2 7:39 AM
        • 0 Attachment
          Benji Fisher wrote:
          >
          > Zdenek Sekera wrote:
          > >
          > > I am hopelessely struggling with the following, convinced it's
          > > my problem somewhere but can't find out where. I managed to
          > > reduce the problem into a trivial case and still don't see it
          > > (coffee doesn't help anymore...;-(
          > >
          > > augroup vimdebug
          > > au!
          > > " autocmd BufRead *.vim :call Snu()
          > > " autocmd BufWrite *.vim :call DelSnu()
          > > autocmd BufRead *.vim :%s/^/111 /
          > > autocmd BufWrite *.vim :%s/^....//
          > > autocmd BufWritePost *.vim :e <afile>
          > > augroup END
          > [snip]
          >
          > :help nested

          That was it!

          > :get sleep ;)

          How I can :-)

          ---Zdenek
        Your message has been successfully submitted and would be delivered to recipients shortly.