Loading ...
Sorry, an error occurred while loading the content.

Re: Autoreload the file opened for viewing when it is changed by external app

Expand Messages
  • Jürgen Krämer
    Hi, ... From :help autoread ... Regards, Jürgen -- Jürgen Krämer Softwareentwicklung Habel GmbH
    Message 1 of 7 , Mar 3, 2005
    • 0 Attachment
      Hi,

      Halim, Salman wrote:
      > The option 'autoread' works for all files, blindly.

      From :help 'autoread'

      | 'autoread' 'ar' boolean (default off)
      | global or local to buffer |global-local|
      | {not in Vi}

      Regards,
      Jürgen

      --
      Jürgen Krämer Softwareentwicklung
      Habel GmbH mailto:jkr@...
      Hinteres Öschle 2 Tel: (0 74 61) 93 53 - 15
      78604 Rietheim-Weilheim Fax: (0 74 61) 93 53 - 99
    • A. J. Mechelynck
      ... Yes, sure; but the OP wanted it on for all readonly files and off for all noreadonly files; and I don t see an easy way to toggle autoread whenever
      Message 2 of 7 , Mar 3, 2005
      • 0 Attachment
        Jürgen Krämer wrote:
        > Hi,
        >
        > Halim, Salman wrote:
        >
        >>The option 'autoread' works for all files, blindly.
        >
        >
        >>From :help 'autoread'
        >
        > | 'autoread' 'ar' boolean (default off)
        > | global or local to buffer |global-local|
        > | {not in Vi}
        >
        > Regards,
        > Jürgen
        >

        Yes, sure; but the OP wanted it on for all 'readonly' files and off for
        all 'noreadonly' files; and I don't see an easy way to toggle 'autoread'
        whenever 'readonly' changes, be it by ":view", ":set[local]
        [no]readonly", editing a file which is readonly on disk (R attribute on
        in Windows or w permission off on Unix), etc.

        Best regards,
        Tony.
      • Keith Roberts
        ... How about ... ... As well as ... au BufNewFile,BufRead * if &ro | setl ar | endif -Keith
        Message 3 of 7 , Mar 4, 2005
        • 0 Attachment
          >-----Original Message-----
          >From: A. J. Mechelynck [mailto:antoine.mechelynck@...]
          >Sent: Thursday, March 03, 2005 10:43 PM
          >To: Jürgen Krämer
          >Cc: vim mailing list
          >Subject: Re: Autoreload the file opened for viewing when it is
          >changed by external app
          >
          >Jürgen Krämer wrote:
          >> Hi,
          >>
          >> Halim, Salman wrote:
          >>
          >>>The option 'autoread' works for all files, blindly.
          >>
          >>
          >>>From :help 'autoread'
          >>
          >> | 'autoread' 'ar' boolean (default off)
          >> | global or local to buffer |global-local|
          >> | {not in Vi}
          >>
          >> Regards,
          >> Jürgen
          >>
          >
          >Yes, sure; but the OP wanted it on for all 'readonly' files
          >and off for all 'noreadonly' files; and I don't see an easy
          >way to toggle 'autoread'
          >whenever 'readonly' changes, be it by ":view", ":set[local]
          >[no]readonly", editing a file which is readonly on disk (R
          >attribute on in Windows or w permission off on Unix), etc.
          >
          >Best regards,
          >Tony.

          How about ...

          :bufdo if &ro | setl ar | endif

          As well as ...

          au BufNewFile,BufRead * if &ro | setl ar | endif

          -Keith
        • Valery Kondakoff
          Hello, A.! Friday, March 4, 2005, 9:43:07 AM, you wrote: AJM Yes, sure; but the OP wanted it on for all readonly files and off for AJM all noreadonly
          Message 4 of 7 , Mar 4, 2005
          • 0 Attachment
            Hello, A.!

            Friday, March 4, 2005, 9:43:07 AM, you wrote:

            AJM> Yes, sure; but the OP wanted it on for all 'readonly' files and off for
            AJM> all 'noreadonly' files; and I don't see an easy way to toggle 'autoread'
            AJM> whenever 'readonly' changes, be it by ":view", ":set[local]
            AJM> [no]readonly", editing a file which is readonly on disk (R attribute on
            AJM> in Windows or w permission off on Unix), etc.

            Hmm... Excuse me, please, if I was not clear enough. My goal was to to
            force gVim to constantly monitor the modification time of the opened
            file if it was open as read-only. File should be reloaded immediately
            after the modification time is changed.

            After some experimenting I can say that I was unable to do this. For
            example, I have a txt-file, that is changed every 5 seconds. If I open
            this file in an editor/viewer, that supports real-time updating of the
            file contents (like BareTail) I can see the changes.

            Now, I'm adding this line to my '_vimrc':

            au FileChangedShell * e!

            After restarting gVim, I was hoping, that now I can open my text file
            in gVim and monitor the changes in real-time. But the file is not
            reloaded until I move the focus out from the gVim window and then
            bring it back. The modification time of the file is changed every five
            seconds (I see this in my file manager). I was trying to set 'ar' and
            'noar' but this does not helps...

            The contents of the file is not updated automatically even when I'm
            starting gVim with '-u NONE' command line switch and enter the ':au
            FileChangedShell * e!' manually.

            Please, help me understand what am I doing wrong! (gVim 6.3 and 7.0aa,
            WinXP SP2)

            Thank you!


            --
            Best regards,
            Valery Kondakoff mailto:strauss@...

            PGP key: mailto:pgp-public-keys@...?subject=GET%20strauss@...


            np: Client: Come On (City)
          Your message has been successfully submitted and would be delivered to recipients shortly.