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

How to check the difference with the origin file

Expand Messages
  • Gregory SACRE
    Hello Vimmers, I was wondering if there is a way to see the differences between the file you are modifying and its original version. For example: Let s say I m
    Message 1 of 5 , Oct 2, 2006
    • 0 Attachment
      Hello Vimmers,


      I was wondering if there is a way to see the differences between the
      file you are modifying and its original version.

      For example:

      Let's say I'm editing a text file. I finished editing it and I'd like
      to see all the changes I've performed on it since I opened it (to
      write down the changes and put them in a CVS or SVN log for example).

      I know there's the :undolist command but it doesn't give me the actual
      changes perfromed.
      Is there a way to do this? Should I use the .swp file in any way?


      Thanks,

      Gregory
    • P├ęter Zsoldos
      Hi, ... If you didn t just give an example and have a different purpose for it, why bother? CVS and SVN already have this functionality, and there is a plugin
      Message 2 of 5 , Oct 2, 2006
      • 0 Attachment
        Hi,

        Gregory SACRE wrote:
        > I was wondering if there is a way to see the differences between the
        > file you are modifying and its original version.
        > Let's say I'm editing a text file. I finished editing it and I'd like
        > to see all the changes I've performed on it since I opened it (to
        > write down the changes and put them in a CVS or SVN log for example).

        If you didn't just give an example and have a different purpose for it,
        why bother? CVS and SVN already have this functionality, and there is a
        plugin for them to be used from inside VIM

        Peter
      • Yakov Lerner
        ... The following nice thing comes from Donn Washburn: command! DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis | wincmd p | diffthis So (1) you puth
        Message 3 of 5 , Oct 2, 2006
        • 0 Attachment
          On 10/2/06, Gregory SACRE <gregory.sacre@...> wrote:
          > I was wondering if there is a way to see the differences between the
          > file you are modifying and its original version.

          The following nice thing comes from Donn Washburn:

          command! DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis |
          wincmd p | diffthis

          So
          (1) you puth the command above in your vimrc
          (2) When you want to see diffs with original (unsaved) file, you do
          :DiffOrig

          If you never used vim-diff-mode, you might need to read about it first,
          or try it in separate window (vimdiff oldfile newfile)

          Yakov
        • Gregory SACRE
          Thank you very much Yakov! It worked perfectly!
          Message 4 of 5 , Oct 2, 2006
          • 0 Attachment
            Thank you very much Yakov!
            It worked perfectly!

            On 10/2/06, Yakov Lerner <iler.ml@...> wrote:
            > On 10/2/06, Gregory SACRE <gregory.sacre@...> wrote:
            > > I was wondering if there is a way to see the differences between the
            > > file you are modifying and its original version.
            >
            > The following nice thing comes from Donn Washburn:
            >
            > command! DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis |
            > wincmd p | diffthis
            >
            > So
            > (1) you puth the command above in your vimrc
            > (2) When you want to see diffs with original (unsaved) file, you do
            > :DiffOrig
            >
            > If you never used vim-diff-mode, you might need to read about it first,
            > or try it in separate window (vimdiff oldfile newfile)
            >
            > Yakov
            >
          • Tim Chase
            ... If you haven t saved the file yet, you can compare the current buffer with the original file contents as described at
            Message 5 of 5 , Oct 2, 2006
            • 0 Attachment
              > I was wondering if there is a way to see the differences between the
              > file you are modifying and its original version.

              If you haven't saved the file yet, you can compare the current
              buffer with the original file contents as described at

              http://tech.groups.yahoo.com/group/vim/message/72287

              a while back:

              :diffthis
              :below vert new
              :r #
              :1d
              :set nomodified
              :diffthis


              which can all be mapped to a single command.

              -tim
            Your message has been successfully submitted and would be delivered to recipients shortly.