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

17873loosing highlighting and more ....

Expand Messages
  • Zdenek Sekera
    Feb 2, 2001
      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
      " 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
      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
      on the line. This works.

      - when the file is written, I want it to be automatically reloaded and
      preprocessed by the BufRead autocmd, so I defined that BufWritePost
      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?

    • Show all 3 messages in this topic