17873loosing highlighting and more ....
- Feb 2, 2001I 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...;-(
" autocmd BufRead *.vim :call Snu()
" autocmd BufWrite *.vim :call DelSnu()
autocmd BufRead *.vim :%s/^/111 /
autocmd BufWrite *.vim :%s/^....//
autocmd BufWritePost *.vim :e <afile>
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
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?
- Next post in topic >>