("Enter" got hit too fast)
On Wed, Mar 28, 2018 at 8:18 PM, Tony Mechelynck
<[email protected]> wrote:
> On Wed, Mar 28, 2018 at 4:36 AM, M Kelly <[email protected]> wrote:
>> Hi,
>>
>> In my .vimrc I have
>>
>> if &diff
>> let b:mckgitstatus = "diff"
>> else
>> autocmd BufReadPost,BufNewFile,FileReadPost * call MyGitStatus()
>> autocmd BufUnload * call MyGitLeave()
>> endif
>>
>> And in the first file window I do see "diff" status as expected.
>> But the second file window does not have the "diff" status, but my git stuff.
>>
>> Any idea why if &diff does not work for the second file window ?
>>
>> thx always for vim and your support,
>> -mark
>
> Simple: Your vimrc is run only once, at startup. At that point,
> buffers have already been created (but not yet loaded) for all files
> mentioned on the vim (or vimdiff or gvimdiff or...) command-line.
> "b:mckgitstatus", a buffer-local variable, is only seen from the
> buffer which was current while sourcing the vimrc, probably the first
> one.
>
> If you want your :if .. :else .. :endif construct to apply to all
> buffers mentioned on the command-line, it should be wrapped in a
> function called from an :argdo statement. OTOH, if you want your
> autocommands to apply to all non-diff buffers whenever created, your
> MyGitStatus and MyGitPost functions should test &l:diff directly
> rather than b:mckgitstatus. CAUTION: 'diff' is a window-local setting and it
> is possible to have several windows, with 'diff' set differently, displaying
> the same buffer. If you only display each diff buffer in one window it ought
> to work.
Best regards,
Tony.
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.