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

Automatically reload file on change

Expand Messages
  • key.vim@googlemail.com
    Hi, I have the following problem: Working on C++ code, I use test cases for my software. So every time I compile, the test log changes. In vim, I have that
    Message 1 of 5 , Feb 2, 2008
      Hi,

      I have the following problem: Working on C++ code, I use test cases
      for my software. So every time I compile, the test log changes. In
      vim, I have that open, and would like to have it reloaded
      automatically, when I switch to the buffer with the test log, without
      VIM asking me.

      Cheers,
      Keyan

      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Andreas Müller
      Hello ... should do the trick. Regards, Andreas
      Message 2 of 5 , Feb 2, 2008
        Hello


        > I have the following problem: Working on C++ code, I use test cases
        > for my software. So every time I compile, the test log changes. In
        > vim, I have that open, and would like to have it reloaded
        > automatically, when I switch to the buffer with the test log, without
        > VIM asking me.

        :set autoread

        should do the trick.

        Regards, Andreas
      • Matt Wozniski
        On Feb 2, 2008 4:31 PM, Andreas Müller wrote: Hello I have the following problem: Working on C++ code, I use test cases for my software. So every
        Message 3 of 5 , Feb 2, 2008
          On Feb 2, 2008 4:31 PM, Andreas Müller wrote:
          > Hello
          >
          > > I have the following problem: Working on C++ code, I use test cases
          > > for my software. So every time I compile, the test log changes. In
          > > vim, I have that open, and would like to have it reloaded
          > > automatically, when I switch to the buffer with the test log, without
          > > VIM asking me.
          >
          > :set autoread
          >
          > should do the trick.
          >
          > Regards, Andreas

          I, personally, would hate to have that setting on - I like that if a
          file accidentally gets modified outside of vim, I can always just
          write out the buffer the way I meant to have it - or selectively merge
          in changes on my own. But, in this particular case (a constantly
          changing test log), I can see the appeal. So, I would suggest doing
          it only specific file names, something in .vimrc like:

          augroup vimrcAu
          au!
          au BufEnter,BufNew Test.log setlocal autoread
          augroup END

          Just my $0.02

          ~Matt

          --~--~---------~--~----~------------~-------~--~----~
          You received this message from the "vim_use" maillist.
          For more information, visit http://www.vim.org/maillist.php
          -~----------~----~----~----~------~----~------~--~---
        • Tony Mechelynck
          ... If you want to apply it only to the specific buffer, then use ... or in short ... ( :set sets it globally). You can also set it for all edits of one
          Message 4 of 5 , Feb 3, 2008
            Eric Tetz wrote:
            > On Feb 2, 2008 7:50 PM, Matt Wozniski <mjw@...> wrote:
            >> I would suggest doing it only specific file names,
            >> something in .vimrc like [snip]
            >
            > Better yet, just do it in the specific buffer. Just takes a second to
            > type ":set ar". I use this all the time, mostly for piping script
            > output into a Vim window.
            >
            > Cheers,
            > Eric

            If you want to apply it only to the specific buffer, then use

            :setlocal autoread

            or in short

            :setl ar

            (":set" sets it globally).

            You can also set it for all edits of one particular file by means of a
            |modeline| e.g.

            vim: autoread

            near the top or bottom of the file.


            Best regards,
            Tony.
            --
            In war we're tough and able.
            Quite indefatigable
            Between our quests
            We sequin vests
            And impersonate Clark Gable
            It's a busy life in Camelot.
            I have to push the pram a lot.
            "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

            --~--~---------~--~----~------------~-------~--~----~
            You received this message from the "vim_use" maillist.
            For more information, visit http://www.vim.org/maillist.php
            -~----------~----~----~----~------~----~------~--~---
          • key.vim@googlemail.com
            Thanks a lot! cheers, keyan On Feb 3, 8:24 am, Tony Mechelynck ... --~--~---------~--~----~------------~-------~--~----~ You
            Message 5 of 5 , Feb 4, 2008
              Thanks a lot!

              cheers,
              keyan

              On Feb 3, 8:24 am, Tony Mechelynck <antoine.mechely...@...>
              wrote:
              > Eric Tetz wrote:
              > > On Feb 2, 2008 7:50 PM, Matt Wozniski <m...@...> wrote:
              > >> I would suggest doing it only specific file names,
              > >> something in .vimrc like [snip]
              >
              > > Better yet, just do it in the specific buffer. Just takes a second to
              > > type ":set ar". I use this all the time, mostly for piping script
              > > output into a Vim window.
              >
              > > Cheers,
              > > Eric
              >
              > If you want to apply it only to the specific buffer, then use
              >
              > :setlocal autoread
              >
              > or in short
              >
              > :setl ar
              >
              > (":set" sets it globally).
              >
              > You can also set it for all edits of one particular file by means of a
              > |modeline| e.g.
              >
              > vim: autoread
              >
              > near the top or bottom of the file.
              >
              > Best regards,
              > Tony.
              > --
              > In war we're tough and able.
              > Quite indefatigable
              > Between our quests
              > We sequin vests
              > And impersonate Clark Gable
              > It's a busy life in Camelot.
              > I have to push the pram a lot.
              > "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
              --~--~---------~--~----~------------~-------~--~----~
              You received this message from the "vim_use" maillist.
              For more information, visit http://www.vim.org/maillist.php
              -~----------~----~----~----~------~----~------~--~---
            Your message has been successfully submitted and would be delivered to recipients shortly.