Yakov Lerner wrote:

> > On 5/23/06, Zdenek Sekera <[EMAIL PROTECTED]> wrote:
> > > create a file ~/.vimtest as follows:
> > >
> > > cat > .vimtest
> > > set nocompatible
> > > set readonly
> > > <C-D>
> > >
> > > and execute (g)vim:
> > >
> > > vim .vimtest -u .vimtest
> > >
> > > try :set readonly? and you'll get 'noreadonly'.
> 
> The buffer does exist when initfile is executed. The ':ls' in initfile shows 
> it.
> Adding more printouts to initfile shows interesting results:
> 
> vim -u 1 1
> ----------------- file called 1 ---------------
> set nocompatible
> ls
> call input('before set readonly 111')
> set readonly
> set readonly?
> ls
> set readonly?
> set readonly?
> echo "&readonly=".&readonly
> call input('after set readonly 222')
> -----------------------------------------------------
> In vim, ':verb set readonly?' shows that readonly is misteriously reset.
> The output differs between vim6 and vim7.
> --------------- vim7 output ------------------
>   1 %    "1"                            line 1
> before set readonly 111
>   1 % =  "1"                            line 1
> 
> 
> &readonly=1
> after set readonly 222
> ----------------------------------------
> Note the missing output of ':set readonly?'!!! It prints neither
> 'readonly' nor 'noreadonly'.
> ----------------- vim6 output --------------------
> 
>   1 %    "1"                            line 1
> before set readonly 111
>  before set readonly 111
>   1 % =  "1"                            line 1
>   readonly
>   readonly
> &readonly=1
> after set readonly 222
> -----------------------------------------------------
> 
> Looks like a bug to me.

For me the "readonly" output is there.  I don't know why you don't get it.

The file is loaded after sourcing the file.  Try putting a getline(3) in
your vim script.  You will see that the file is not loaded yet.  Thus
the buffer exists but doesn't contain the file text yet.

'readonly' is set according to the file edited.  If you want to set it,
you need to use something like:

        vim file +"set readonly"

The "+" arguments are done after loading the file.

It was already like this in Vim 6.0.  I don't know why you say it
differs between vim 6 and vim 7.

-- 
CUSTOMER:     You're not fooling anyone y'know.  Look, isn't there something
              you can do?
DEAD PERSON:  I feel happy... I feel happy.
    [whop]
CUSTOMER:     Ah, thanks very much.
MORTICIAN:    Not at all.  See you on Thursday.
CUSTOMER:     Right.
                                  The Quest for the Holy Grail (Monty Python)

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

Reply via email to