I've found strange behaviour in vim.
When doing "autocmd VimEnter * nested badd ..." syntax highlight work as
expected, means i see colors. I can use "bnext" and see colors in all badd'ed
files.
However if i do "autocmd VimEnter * nested source ..." and inside the file i
use badd, then there are no colors in buffers unless i run "edit ..." (this
can be done in the sourced file). When using bnext i don't see colors
(i.e. "syntax" returns "No Syntax items defined for this buffer).
I guess that some issue with autocomd's. Is there something that i miss? How
can i correctly add buffer in the file sourced in "autocmd VimEnter".
--
Michal Kurgan
maybe it's rather caused by your strange setup?
> When doing "autocmd VimEnter * nested badd ..." syntax highlight work as
> expected, means i see colors. I can use "bnext" and see colors in all badd'ed
> files.
didn't check the above, but expected to work
> However if i do "autocmd VimEnter * nested source ..." and inside the file i
> use badd, then there are no colors in buffers unless i run "edit ..." (this
> can be done in the sourced file). When using bnext i don't see colors
> (i.e. "syntax" returns "No Syntax items defined for this buffer).
works here, without problems:
gvim.exe -N -u e_vimrc -U NONE
" --- e_vimrc ---
au VimEnter * nested source addfiles.vim
syntax on
" --- addfiles.vim ---
badd start.bat
badd e_vimrc
> I guess that some issue with autocomd's. Is there something that i miss? How
> can i correctly add buffer in the file sourced in "autocmd VimEnter".
usually to have some files in the buffer list after startup, one
will use :args (much better than :edit-ing all the files).
--
Andy
>
> Michal Kurgan schrieb:
> > Hello!
> >
> > I've found strange behaviour in vim.
>
> maybe it's rather caused by your strange setup?
>
> > When doing "autocmd VimEnter * nested badd ..." syntax highlight work as
> > expected, means i see colors. I can use "bnext" and see colors in all
> > badd'ed files.
>
> didn't check the above, but expected to work
>
It turns that i have to experiment more to find what is the problem, see
below.
> > However if i do "autocmd VimEnter * nested source ..." and inside the
> > file i use badd, then there are no colors in buffers unless i run
> > "edit ..." (this can be done in the sourced file). When using bnext i
> > don't see colors (i.e. "syntax" returns "No Syntax items defined for this
> > buffer).
>
> works here, without problems:
>
> [ ... ]
I found that the culprit was bufdo command that i used in sourced file right
after series of badd calls... It's is even written that Syntax is disabled
there, thus it enumerates buffers and disables colors. What is strange,
colors are there when buffers are opened with "edit" before the bufdo.
In my case moving bufdo before badd calls or adding "edit's" solved problem.
Now, if *this* bufdo behaviour is normal...
--
Michal Kurgan