Saturday, May 1, 2010

Re: How to automatically update the view in a vim when the same file is changed in other vim session?

On 01/05/10 20:38, Peng Yu wrote:
>
>
> On May 1, 10:19 am, Tony Mechelynck<antoine.mechely...@gmail.com>
> wrote:
>> On 01/05/10 16:30, Peng Yu wrote:
>>
>>> If I open the same file in two gvim sessions, and modify and write the
>>> file in one session, the other session will be notified. However, this
>>> is not true for vim. Is there a way to configure vim do the same thing?
>>
>> See :help 'autoread'
>>
>> Note that Vim doesn't know that "the other program" which modified the
>> file is another instance of Vim -- it could be anything. Also, this
>> won't work if Vim notices that a 'modified' file has also been modified
>> somewhere else: in this case you will have to decide which changes to trash.
>>
>> Finer control (but also more occasions to shoot yourself in the foot) is
>> afforded by the FileChangedShell autocommand event.
>
> I type :set autoread in both vim session starting from genome-
> terminal. Then, I write to the file from one vim session, the other
> vim doesn't know the file has been changed. However, gvim knows a file
> has been changed. Therefore, I doubt that it is because of some
> configuration problem.
>
> Then, what is the different between gvim and vim cause the difference
> in this behavior?
>

See :help FileChangedShell

gvim checks the file's timestamp when it regains input focus. Most
console versions cannot detect that they have lost or gained focus, see
":help FocusGained" and ":help FocusLost".

The command
:checktime
(q.v.) will also trigger the check.


Best regards,
Tony.
--
ARTHUR: Well, it doesn't matter. Will you go and tell your master that
Arthur from the Court of Camelot is here.
GUARD #1: Listen, in order to maintain air-speed velocity, a swallow
needs to beat its wings 43 times every second, right?
ARTHUR: Please!
The Quest for the Holy Grail (Monty
Python)

--
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

No comments:

Post a Comment