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

Re: Automatic updating file content

Expand Messages
  • Tien Pham
    Hi Peter Thank you very much for your time/help. The previous group of commands works really well for me already. I have enjoyed the convenience it s brought
    Message 1 of 13 , Aug 1, 2006
    • 0 Attachment
      Hi Peter

      Thank you very much for your time/help. The previous group of commands
      works really well for me already. I have enjoyed the convenience it's
      brought so far. A click to update the content was what I wished for, but
      now I have more than what I wished for!

      Many many thanks again
      Regards
      tien


      At 02:41 PM 2/08/2006 +1000, you wrote:
      > >
      > > Thank you very much for the tip. ":e" works so nicely. I will try out
      > those
      > > commands soon. Should I insert them in my vimrc file ?
      > >
      >
      >Hi Tien,
      >
      >Sorry, it seems I was a little naive with that autocommand I showed you, it
      >doesn't work because CursorHold won't trigger again until you press a key.
      >After a little experimentation, I think you would best add something like this
      >to your .vimrc:
      >
      > function! s:ReloadWhileWaiting()
      > while ! getchar(1)
      > edit
      > normal G
      > sleep 1
      > endwhile
      > endfunction
      >
      > augroup RefreshFile
      > autocmd!
      > autocmd CursorHold somefile.log call s:ReloadWhileWaiting()
      > augroup end
      >
      >The automatic refresh ('s:ReloadWhileWaiting()') only begins after Vim is idle
      >for 4 seconds; after that it will reload the file ('edit'), move to the end
      >('normal G') and wait for a second before it tries again ('sleep
      >1'). Pressing
      >any key will stop the automatic refreshing ('while ! getchar(1)'), but it will
      >resume as soon as Vim is idle for 4 seconds again. I hope that's all
      >clear and
      >does what you need or that you can customize it easily.
      >
      >regards,
      >Peter
      >
      >
      >
      >Send instant messages to your online friends http://au.messenger.yahoo.com
    • Mark Woodward
      Hi Tien, On Wed, 02 Aug 2006 12:09:39 +1000 ... I think there s a setting to reload a changed file but for the life of me can t think of it! Sorry, that s not
      Message 2 of 13 , Aug 2, 2006
      • 0 Attachment
        Hi Tien,

        On Wed, 02 Aug 2006 12:09:39 +1000
        Tien Pham <t.ducpham@...> wrote:

        > Hi all
        >
        > Is there any key stroke to update content of a currently open file
        > when its content has been changed?
        >
        > Reason for this is that I want to look at my log file from a
        > simulation, as I run simulation so frequently, it is so tedious to
        > click "open" and "select" the same file name to see the changes that
        > a new simulation is recorded in the log file. I would appreciate very
        > much if someone teach me a quick way to update content of the file I
        > have opened, of course the same file name.
        >
        > Your help is greatly appreciated.
        > Kind regards
        > tien
        >

        I think there's a setting to reload a changed file but for the life of
        me can't think of it!

        Sorry, that's not much help!

        --
        Mark
      • A.J.Mechelynck
        ... see :help timestamp and read the whole section 10. Timestamps . Best regards, Tony.
        Message 3 of 13 , Aug 2, 2006
        • 0 Attachment
          Mark Woodward wrote:
          > Hi Tien,
          >
          > On Wed, 02 Aug 2006 12:09:39 +1000
          > Tien Pham <t.ducpham@...> wrote:
          >
          >> Hi all
          >>
          >> Is there any key stroke to update content of a currently open file
          >> when its content has been changed?
          >>
          >> Reason for this is that I want to look at my log file from a
          >> simulation, as I run simulation so frequently, it is so tedious to
          >> click "open" and "select" the same file name to see the changes that
          >> a new simulation is recorded in the log file. I would appreciate very
          >> much if someone teach me a quick way to update content of the file I
          >> have opened, of course the same file name.
          >>
          >> Your help is greatly appreciated.
          >> Kind regards
          >> tien
          >>
          >
          > I think there's a setting to reload a changed file but for the life of
          > me can't think of it!
          >
          > Sorry, that's not much help!
          >

          see ":help timestamp" and read the whole section "10. Timestamps".


          Best regards,
          Tony.
        • Charles E Campbell Jr
          ... CursorHold will fire (once) some time has elapsed after a key has been pressed. Of course, if one wishes to simply watch the file change and isn t
          Message 4 of 13 , Aug 2, 2006
          • 0 Attachment
            Peter Hodge wrote:

            >Sorry, it seems I was a little naive with that autocommand I showed you, it
            >doesn't work because CursorHold won't trigger again until you press a key.
            >After a little experimentation, I think you would best add something like this
            >
            >
            CursorHold will fire (once) some time has elapsed after a key has been
            pressed. Of course, if one wishes
            to simply watch the file change and isn't pressing keys, this method
            won't work well. So, may I suggest
            that one use two vims -- one a "tickler" and one your actual display.
            This approach your vims have the
            +clientserver option compiled in.

            Here's the idea for the tickler in rough:

            1. the "actual display" vim is also started up as a server

            2. the tickler is running
            while 1
            sleep 1
            endwhile

            3. inside the tickler's while loop it also does a
            remote_send(server,":e")

            Ideally commands would only be sent when the "actual display" vim is in
            normal mode.
            Perhaps something tricky with RemoteReply autocmds, etc could be used to
            insure this.

            Regards,
            Chip Campbell
          • Tien Pham
            Hi Mark and Tony Thank you for your help, very much appreciated. Kind regards tien
            Message 5 of 13 , Aug 2, 2006
            • 0 Attachment
              Hi Mark and Tony

              Thank you for your help, very much appreciated.
              Kind regards
              tien


              At 12:43 PM 2/08/2006 +0200, A.J.Mechelynck wrote:
              >Mark Woodward wrote:
              >>Hi Tien,
              >>On Wed, 02 Aug 2006 12:09:39 +1000
              >>Tien Pham <t.ducpham@...> wrote:
              >>
              >>>Hi all
              >>>
              >>>Is there any key stroke to update content of a currently open file
              >>>when its content has been changed?
              >>>
              >>>Reason for this is that I want to look at my log file from a
              >>>simulation, as I run simulation so frequently, it is so tedious to
              >>>click "open" and "select" the same file name to see the changes that
              >>>a new simulation is recorded in the log file. I would appreciate very
              >>>much if someone teach me a quick way to update content of the file I
              >>>have opened, of course the same file name.
              >>>
              >>>Your help is greatly appreciated.
              >>>Kind regards
              >>>tien
              >>I think there's a setting to reload a changed file but for the life of
              >>me can't think of it!
              >>Sorry, that's not much help!
              >
              >see ":help timestamp" and read the whole section "10. Timestamps".
              >
              >
              >Best regards,
              >Tony.
            • Tien Pham
              Hi everyone Thanks Clip for your tip. I have to say that this VIM group has so many helpful experts. For people with limited understanding in computing
              Message 6 of 13 , Aug 2, 2006
              • 0 Attachment
                Hi everyone

                Thanks Clip for your tip.
                I have to say that this VIM group has so many helpful experts. For people
                with limited understanding in computing language like me, this is so great
                and I am very grateful.

                Regards
                tien




                At 12:11 PM 2/08/2006 -0400, Charles E Campbell Jr wrote:
                >Peter Hodge wrote:
                >
                >>Sorry, it seems I was a little naive with that autocommand I showed you, it
                >>doesn't work because CursorHold won't trigger again until you press a
                >>key. After a little experimentation, I think you would best add something
                >>like this
                >>
                >CursorHold will fire (once) some time has elapsed after a key has been
                >pressed. Of course, if one wishes
                >to simply watch the file change and isn't pressing keys, this method won't
                >work well. So, may I suggest
                >that one use two vims -- one a "tickler" and one your actual display.
                >This approach your vims have the
                >+clientserver option compiled in.
                >
                >Here's the idea for the tickler in rough:
                >
                > 1. the "actual display" vim is also started up as a server
                >
                >2. the tickler is running
                > while 1
                > sleep 1
                > endwhile
                >
                >3. inside the tickler's while loop it also does a
                > remote_send(server,":e")
                >
                >Ideally commands would only be sent when the "actual display" vim is in
                >normal mode.
                >Perhaps something tricky with RemoteReply autocmds, etc could be used to
                >insure this.
                >
                >Regards,
                >Chip Campbell
              • Tien Pham
                I am terribly sorry that I misspelled your name Chip. My apologies tien pham
                Message 7 of 13 , Aug 2, 2006
                • 0 Attachment
                  I am terribly sorry that I misspelled your name Chip.
                  My apologies
                  tien pham
                • Charles E Campbell Jr
                  ... No problem! You should see what people do to my last name.... Chip Campbell
                  Message 8 of 13 , Aug 3, 2006
                  • 0 Attachment
                    Tien Pham wrote:

                    > I am terribly sorry that I misspelled your name Chip.
                    > My apologies


                    No problem! You should see what people do to my last name....
                    Chip Campbell
                  Your message has been successfully submitted and would be delivered to recipients shortly.