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

RE: Config Vim not to change directory timestamp

Expand Messages
  • Keith Roberts
    ... Creating a swapfile shouldn t matter either, as long as directory doesn t contain . . Patchmode might be causing the problem if it is set, since the
    Message 1 of 18 , Oct 3, 2003
    • 0 Attachment
      >-----Original Message-----
      >From: Gary Johnson [mailto:garyjohn@...]
      >Sent: Friday, October 03, 2003 1:04 PM
      >To: vim-dev@...
      >Subject: Re: Config Vim not to change directory timestamp
      >
      >On 2003-10-03, Bram Moolenaar <Bram@...> wrote:
      >> Roboco Sanchez wrote:
      >>
      >> > Vim shouldn't change the timestamp of the directory in
      >> > which the file it's saving resides. Vim is the only
      >> > editor to do so. It's really annoyance when you modify
      >> > a file but your directory timestamp is also changed.
      >> > No, I'm not talking about swap file or backup file.
      >> > I'm talking about the directory NNNN that Vim creates
      >> > before saving the file and deletes just after the file
      >> > is saved. So "set backupdir" or "set directory"
      >> > wouldn't help. Please introduce "set secretdir" for
      >> > that NNN directory or just create it in the path of
      >> > "set backupdir" or "set directory". Many thanks.
      >>
      >> I have no idea what you are talking about. Vim doesn't create a
      >> directory next to the file it writes.
      >>
      >> Anyway, if you write a file it's not strange that the directory it
      >> contains is changed. You can avoid this by letting Vim overwrite the
      >> original file (reset 'backup' and 'writebackup') but you risk loosing
      >> your work if the power drops that moment. On Unix the directory is
      >> still changed anyway, since the timestamp of the file is updated.
      >
      >The file's timestamp is kept in the inode, not in the directory, so
      >changing a file's contents should not affect the directory.
      >
      >If I have
      >
      > set nobackup
      > set nowritebackup
      > set noswapfile
      >
      >in my ~/.vimrc, and I use vim to modify a file, the directory time
      >stamp is not changed. (This is using vim-6.2 on HP-UX 10.20.)
      >
      >I have no idea what this "NNN directory" could be, either. Some
      >plugin?
      >
      >Gary
      >

      Creating a swapfile shouldn't matter either, as long as 'directory' doesn't
      contain ".".

      Patchmode might be causing the problem if it is set, since the backup file
      is copied to filename.orig (or the like) ... also in the "." directory.
    • Gary Johnson
      ... I didn t intend that to be a solution--I was only trying to verify my assertion that modifying a file on a Unix file system does not change the directory
      Message 2 of 18 , Oct 3, 2003
      • 0 Attachment
        On 2003-10-03, Roboco Sanchez <roboco2004@...> wrote:
        > --- Gary Johnson <garyjohn@...> wrote:
        > > On 2003-10-03, Bram Moolenaar <Bram@...>
        > > wrote:
        > > > Roboco Sanchez wrote:
        > > >
        > > > > Vim shouldn't change the timestamp of the
        > > directory in
        > > > > which the file it's saving resides. Vim is the
        > > only
        > > > > editor to do so. It's really annoyance when you
        > > modify
        > > > > a file but your directory timestamp is also
        > > changed.
        > > > > No, I'm not talking about swap file or backup
        > > file.
        > > > > I'm talking about the directory NNNN that Vim
        > > creates
        > > > > before saving the file and deletes just after
        > > the file
        > > > > is saved. So "set backupdir" or "set directory"
        > > > > wouldn't help. Please introduce "set secretdir"
        > > for
        > > > > that NNN directory or just create it in the path
        > > of
        > > > > "set backupdir" or "set directory". Many thanks.
        > > >
        > > > I have no idea what you are talking about. Vim
        > > doesn't create a
        > > > directory next to the file it writes.
        > > >
        > > > Anyway, if you write a file it's not strange that
        > > the directory it
        > > > contains is changed. You can avoid this by
        > > letting Vim overwrite the
        > > > original file (reset 'backup' and 'writebackup')
        > > but you risk loosing
        > > > your work if the power drops that moment. On Unix
        > > the directory is
        > > > still changed anyway, since the timestamp of the
        > > file is updated.
        > >
        > > The file's timestamp is kept in the inode, not in
        > > the directory, so
        > > changing a file's contents should not affect the
        > > directory.
        > >
        > > If I have
        > >
        > > set nobackup
        > > set nowritebackup
        > > set noswapfile
        > >
        > > in my ~/.vimrc, and I use vim to modify a file, the
        > > directory time
        > > stamp is not changed. (This is using vim-6.2 on
        > > HP-UX 10.20.)
        > >
        > > I have no idea what this "NNN directory" could be,
        > > either. Some
        > > plugin?

        > You solution does solve the problem of directory
        > timestamp but you won't have the backup file in your
        > backup dir. I would still want both swapfile and
        > backupfile as normal.

        I didn't intend that to be a solution--I was only trying to verify
        my assertion that modifying a file on a Unix file system does not
        change the directory time stamp.

        > Vim does create a dir named NNNN where N is a decimal
        > digit even though you use "set backupdir" to tell Vim
        > to write backup file somewhere else. If you use
        > Windows you can use Sysinternals' FileMon to monitor
        > Vim's disk activities and you'll see the real name of
        > the dir I'm talking about. On *NIX I'm not sure what
        > tool to use.

        I know there is such a tool for Unix, but I've never used it and I
        can't think of the name.

        If I make those same settings in the C:\Vim\_vimrc file on my
        Windows2000 machine, I can also edit a file using gvim without
        changing the time stamp on the directory. So I don't doubt that
        you're seeing what you say you're seeing, but I don't think it is
        caused by vim itself. My guess is still that you have some plugin
        that defines an autocommand that's executed when you save a file.
        Try executing the following commands:

        :au BufWrite
        :au BufWritePost
        :au BufWriteCmd

        They will show you the current autocommands for each of those
        events.

        HTH,
        Gary

        --
        Gary Johnson | Agilent Technologies
        garyjohn@... | Wireless Division
        | Spokane, Washington, USA
      • Roboco Sanchez
        ... USA Exactly, that why I said your solution solved the problem of directory timestamp. On your Win2k you should try not to set those instead and set
        Message 3 of 18 , Oct 4, 2003
        • 0 Attachment
          --- Gary Johnson <garyjohn@...> wrote:
          > On 2003-10-03, Roboco Sanchez <roboco2004@...>
          > wrote:
          > > --- Gary Johnson <garyjohn@...> wrote:
          > > > On 2003-10-03, Bram Moolenaar
          > <Bram@...>
          > > > wrote:
          > > > > Roboco Sanchez wrote:
          > > > >
          > > > > > Vim shouldn't change the timestamp of the
          > > > directory in
          > > > > > which the file it's saving resides. Vim is
          > the
          > > > only
          > > > > > editor to do so. It's really annoyance when
          > you
          > > > modify
          > > > > > a file but your directory timestamp is also
          > > > changed.
          > > > > > No, I'm not talking about swap file or
          > backup
          > > > file.
          > > > > > I'm talking about the directory NNNN that
          > Vim
          > > > creates
          > > > > > before saving the file and deletes just
          > after
          > > > the file
          > > > > > is saved. So "set backupdir" or "set
          > directory"
          > > > > > wouldn't help. Please introduce "set
          > secretdir"
          > > > for
          > > > > > that NNN directory or just create it in the
          > path
          > > > of
          > > > > > "set backupdir" or "set directory". Many
          > thanks.
          > > > >
          > > > > I have no idea what you are talking about.
          > Vim
          > > > doesn't create a
          > > > > directory next to the file it writes.
          > > > >
          > > > > Anyway, if you write a file it's not strange
          > that
          > > > the directory it
          > > > > contains is changed. You can avoid this by
          > > > letting Vim overwrite the
          > > > > original file (reset 'backup' and
          > 'writebackup')
          > > > but you risk loosing
          > > > > your work if the power drops that moment. On
          > Unix
          > > > the directory is
          > > > > still changed anyway, since the timestamp of
          > the
          > > > file is updated.
          > > >
          > > > The file's timestamp is kept in the inode, not
          > in
          > > > the directory, so
          > > > changing a file's contents should not affect the
          > > > directory.
          > > >
          > > > If I have
          > > >
          > > > set nobackup
          > > > set nowritebackup
          > > > set noswapfile
          > > >
          > > > in my ~/.vimrc, and I use vim to modify a file,
          > the
          > > > directory time
          > > > stamp is not changed. (This is using vim-6.2 on
          > > > HP-UX 10.20.)
          > > >
          > > > I have no idea what this "NNN directory" could
          > be,
          > > > either. Some
          > > > plugin?
          >
          > > You solution does solve the problem of directory
          > > timestamp but you won't have the backup file in
          > your
          > > backup dir. I would still want both swapfile and
          > > backupfile as normal.
          >
          > I didn't intend that to be a solution--I was only
          > trying to verify
          > my assertion that modifying a file on a Unix file
          > system does not
          > change the directory time stamp.
          >
          > > Vim does create a dir named NNNN where N is a
          > decimal
          > > digit even though you use "set backupdir" to tell
          > Vim
          > > to write backup file somewhere else. If you use
          > > Windows you can use Sysinternals' FileMon to
          > monitor
          > > Vim's disk activities and you'll see the real name
          > of
          > > the dir I'm talking about. On *NIX I'm not sure
          > what
          > > tool to use.
          >
          > I know there is such a tool for Unix, but I've never
          > used it and I
          > can't think of the name.
          >
          > If I make those same settings in the C:\Vim\_vimrc
          > file on my
          > Windows2000 machine, I can also edit a file using
          > gvim without
          > changing the time stamp on the directory. So I
          > don't doubt that
          > you're seeing what you say you're seeing, but I
          > don't think it is
          > caused by vim itself. My guess is still that you
          > have some plugin
          > that defines an autocommand that's executed when you
          > save a file.
          > Try executing the following commands:
          >
          > :au BufWrite
          > :au BufWritePost
          > :au BufWriteCmd
          >
          > They will show you the current autocommands for each
          > of those
          > events.
          >
          > HTH,
          > Gary
          >
          > --
          > Gary Johnson | Agilent Technologies
          > garyjohn@... | Wireless Division
          > | Spokane, Washington,
          USA

          Exactly, that why I said your solution solved the
          problem of directory timestamp. On your Win2k you
          should try not to set those instead and set backupfile
          path and swapfile path to somewhere else. See if the
          directory timestamp changes or not. We still want
          backup file and swap file when editing.

          Here is what you asked:

          :au BufWrite
          --- Auto-Commands ---
          Hit ENTER or type command to continue

          :au BufWritePost
          --- Auto-Commands ---
          gzip BufWritePost
          *.gz call s:write("gzip")
          *.bz2 call s:write("bzip2")
          *.Z call s:write("compress -f")
          Hit ENTER or type command to continue

          :au BufWriteCmd
          --- Auto-Commands ---
          ftp://* exe "Nwrite " .expand("<afile>")
          rcp://* exe "Nwrite " .expand("<afile>")
          scp://* exe "Nwrite " .expand("<afile>")
          dav://* exe "Nwrite " .expand("<afile>")
          rsync://* exe "Nwrite " .expand("<afile>")
          Hit ENTER or type command to continue

          By the way when you do ":au BufWriteCmd" or any other
          commands like that ( :set for instance) how do you
          copy the output to Windows buffer? I can't use my
          mouse to copy the text.

          Cheers,
          Robo.


          __________________________________
          Do you Yahoo!?
          The New Yahoo! Shopping - with improved product search
          http://shopping.yahoo.com
        • Roboco Sanchez
          ... USA You solution does solve the problem of directory timestamp but you won t have the backup file in your backup dir. I would still want both swapfile and
          Message 4 of 18 , Oct 4, 2003
          • 0 Attachment
            --- Gary Johnson <garyjohn@...> wrote:
            > On 2003-10-03, Bram Moolenaar <Bram@...>
            > wrote:
            > > Roboco Sanchez wrote:
            > >
            > > > Vim shouldn't change the timestamp of the
            > directory in
            > > > which the file it's saving resides. Vim is the
            > only
            > > > editor to do so. It's really annoyance when you
            > modify
            > > > a file but your directory timestamp is also
            > changed.
            > > > No, I'm not talking about swap file or backup
            > file.
            > > > I'm talking about the directory NNNN that Vim
            > creates
            > > > before saving the file and deletes just after
            > the file
            > > > is saved. So "set backupdir" or "set directory"
            > > > wouldn't help. Please introduce "set secretdir"
            > for
            > > > that NNN directory or just create it in the path
            > of
            > > > "set backupdir" or "set directory". Many thanks.
            > >
            > > I have no idea what you are talking about. Vim
            > doesn't create a
            > > directory next to the file it writes.
            > >
            > > Anyway, if you write a file it's not strange that
            > the directory it
            > > contains is changed. You can avoid this by
            > letting Vim overwrite the
            > > original file (reset 'backup' and 'writebackup')
            > but you risk loosing
            > > your work if the power drops that moment. On Unix
            > the directory is
            > > still changed anyway, since the timestamp of the
            > file is updated.
            >
            > The file's timestamp is kept in the inode, not in
            > the directory, so
            > changing a file's contents should not affect the
            > directory.
            >
            > If I have
            >
            > set nobackup
            > set nowritebackup
            > set noswapfile
            >
            > in my ~/.vimrc, and I use vim to modify a file, the
            > directory time
            > stamp is not changed. (This is using vim-6.2 on
            > HP-UX 10.20.)
            >
            > I have no idea what this "NNN directory" could be,
            > either. Some
            > plugin?
            >
            > Gary
            >
            > --
            > Gary Johnson | Agilent Technologies
            > garyjohn@... | Wireless Division
            > | Spokane, Washington,
            USA

            You solution does solve the problem of directory
            timestamp but you won't have the backup file in your
            backup dir. I would still want both swapfile and
            backupfile as normal.

            Vim does create a dir named NNNN where N is a decimal
            digit even though you use "set backupdir" to tell Vim
            to write backup file somewhere else. If you use
            Windows you can use Sysinternals' FileMon to monitor
            Vim's disk activities and you'll see the real name of
            the dir I'm talking about. On *NIX I'm not sure what
            tool to use.

            Cheers,
            Robo.


            __________________________________
            Do you Yahoo!?
            The New Yahoo! Shopping - with improved product search
            http://shopping.yahoo.com
          • Roboco Sanchez
            ... In fact, it does. ... It s not strange. But it s not the way it should be either. You re editing file not directory. ... Not with set backupdir or set
            Message 5 of 18 , Oct 4, 2003
            • 0 Attachment
              --- Bram Moolenaar <Bram@...> wrote:
              >
              > Roboco Sanchez wrote:
              >
              > > Vim shouldn't change the timestamp of the
              > directory in
              > > which the file it's saving resides. Vim is the
              > only
              > > editor to do so. It's really annoyance when you
              > modify
              > > a file but your directory timestamp is also
              > changed.
              > > No, I'm not talking about swap file or backup
              > file.
              > > I'm talking about the directory NNNN that Vim
              > creates
              > > before saving the file and deletes just after the
              > file
              > > is saved. So "set backupdir" or "set directory"
              > > wouldn't help. Please introduce "set secretdir"
              > for
              > > that NNN directory or just create it in the path
              > of
              > > "set backupdir" or "set directory". Many thanks.
              >
              > I have no idea what you are talking about. Vim
              > doesn't create a
              > directory next to the file it writes.

              In fact, it does.

              >
              > Anyway, if you write a file it's not strange that
              > the directory it
              > contains is changed. You can avoid this by letting

              It's not strange. But it's not the way it should be
              either. You're editing file not directory.

              > Vim overwrite the
              > original file (reset 'backup' and 'writebackup') but
              > you risk loosing
              > your work if the power drops that moment.

              Not with "set backupdir" or "set directory" to other
              place, the proper "temp".

              > On Unix the directory is
              > still changed anyway, since the timestamp of the
              > file is updated.

              Sorry, you're wrong. Try "echo "Hello" >> /etc/hosts"
              or "cp /etc/services /etc/hosts" and see if timestamp
              of /etc changes or not.

              Cheers,
              Robo.


              >
              > --
              > From "know your smileys":
              > :-)-O Smiling doctor with stethoscope
              >
              > /// Bram Moolenaar -- Bram@... --
              > http://www.Moolenaar.net \\\
              > /// Creator of Vim - Vi IMproved --
              > http://www.Vim.org \\\
              > \\\ Project leader for A-A-P --
              > http://www.A-A-P.org ///
              > \\\ Help AIDS victims, buy here:
              > http://ICCF-Holland.org/click1.html ///


              __________________________________
              Do you Yahoo!?
              The New Yahoo! Shopping - with improved product search
              http://shopping.yahoo.com
            • Roboco Sanchez
              It does happen on Linux as well. Robo. ... __________________________________ Do you Yahoo!? The New Yahoo! Shopping - with improved product search
              Message 6 of 18 , Oct 4, 2003
              • 0 Attachment
                It does happen on Linux as well.

                Robo.


                --- Giuseppe Bilotta <gip.bilotta@...> wrote:
                > On Friday, October 3, 2003 Roboco Sanchez wrote:
                > > Vim shouldn't change the timestamp of the
                > directory in
                > > which the file it's saving resides. Vim is the
                > only
                > > editor to do so. It's really annoyance when you
                > modify
                > > a file but your directory timestamp is also
                > changed.
                > > No, I'm not talking about swap file or backup
                > file.
                > > I'm talking about the directory NNNN that Vim
                > creates
                > > before saving the file and deletes just after the
                > file
                > > is saved. So "set backupdir" or "set directory"
                > > wouldn't help. Please introduce "set secretdir"
                > for
                > > that NNN directory or just create it in the path
                > of
                > > "set backupdir" or "set directory". Many thanks.
                >
                > Let me guess --you have WinNT/2K/XP with an NTFS
                > parition?
                >
                > It's a O/S feature
                >
                > --
                > Giuseppe "Oblomov" Bilotta
                >


                __________________________________
                Do you Yahoo!?
                The New Yahoo! Shopping - with improved product search
                http://shopping.yahoo.com
              • Giuseppe Bilotta
                ... I don t know the details about ext2 but I think it s a feature in all modern filesystems. It doesn t happen on FAT/FAT32 systesm, that I know of (at least
                Message 7 of 18 , Oct 4, 2003
                • 0 Attachment
                  On Saturday, October 4, 2003 Roboco Sanchez wrote:
                  > It does happen on Linux as well.

                  I don't know the details about ext2 but I think it's a feature
                  in all modern filesystems. It doesn't happen on FAT/FAT32
                  systesm, that I know of (at least I didn't notice it when I
                  used Win98)

                  --
                  Giuseppe "Oblomov" Bilotta
                • Roboco Sanchez
                  ... On FAT/FAT32: if you create a new file or dir the timestamp of the dir in which you re creating the new file/dir won t change. On NTFS/ExtN/General *NIX
                  Message 8 of 18 , Oct 4, 2003
                  • 0 Attachment
                    --- Giuseppe Bilotta <gip.bilotta@...> wrote:
                    > On Saturday, October 4, 2003 Roboco Sanchez wrote:
                    > > It does happen on Linux as well.
                    >
                    > I don't know the details about ext2 but I think it's
                    > a feature
                    > in all modern filesystems. It doesn't happen on
                    > FAT/FAT32
                    > systesm, that I know of (at least I didn't notice it
                    > when I
                    > used Win98)
                    >
                    > --
                    > Giuseppe "Oblomov" Bilotta
                    >

                    On FAT/FAT32:

                    if you create a new file or dir the timestamp of the
                    dir in which you're creating the new file/dir won't
                    change.

                    On NTFS/ExtN/General *NIX FS:

                    the dir timestamp will change when you:
                    - creat a new file/dir
                    - delete a file/dir
                    - rename a file/dir
                    but it won't change when you:
                    - add a byte to an existing file
                    - edit an existing file using any editor except Vim
                    - copy a file from somewhere else over an existing
                    file, i.e., the destination filename is a name of an
                    exisiting file

                    Cheers,
                    Robo.


                    __________________________________
                    Do you Yahoo!?
                    The New Yahoo! Shopping - with improved product search
                    http://shopping.yahoo.com
                  • Roboco Sanchez
                    ... It shouldn t matter what OS you re using. You re changing content of a file not a directory. I ve never come across any OS that changes directory timestamp
                    Message 9 of 18 , Oct 4, 2003
                    • 0 Attachment
                      --- Bram Moolenaar <Bram@...> wrote:
                      >
                      > Roboco Sanchez wrote:
                      >
                      > > > > Vim shouldn't change the timestamp of the
                      > directory in
                      > > > > which the file it's saving resides. Vim is the
                      > only
                      > > > > editor to do so. It's really annoyance when
                      > you modify
                      > > > > a file but your directory timestamp is also
                      > changed.
                      > > > > No, I'm not talking about swap file or backup
                      > file.
                      > > > > I'm talking about the directory NNNN that Vim
                      > creates
                      > > > > before saving the file and deletes just after
                      > the file
                      > > > > is saved. So "set backupdir" or "set
                      > directory"
                      > > > > wouldn't help. Please introduce "set
                      > secretdir" for
                      > > > > that NNN directory or just create it in the
                      > path of
                      > > > > "set backupdir" or "set directory". Many
                      > thanks.
                      > > >
                      > > > I have no idea what you are talking about. Vim
                      > doesn't create a
                      > > > directory next to the file it writes.
                      > >
                      > > In fact, it does.
                      >
                      > Perhaps there is a plugin or autocommand that does
                      > this.
                      > Try setting 'verbose' to find out what happens. I
                      > can't think of a
                      > plugin that creates a NNNN directory though.
                      >
                      > > > Anyway, if you write a file it's not strange
                      > that the directory it
                      > > > contains is changed. You can avoid this by
                      > letting
                      > >
                      > > It's not strange. But it's not the way it should
                      > be
                      > > either. You're editing file not directory.
                      >
                      > The directory is like an index. If you change
                      > something that a
                      > directory contains the directory changes.
                      >
                      > > > On Unix the directory is still changed anyway,
                      > since the timestamp
                      > > > of the file is updated.
                      > >
                      > > Sorry, you're wrong. Try "echo "Hello" >>
                      > /etc/hosts"
                      > > or "cp /etc/services /etc/hosts" and see if
                      > timestamp
                      > > of /etc changes or not.
                      >
                      > Perhaps this depends on the OS you are using.
                      > Creating or deleting a
                      > file always sets the timestamp of the directory on
                      > FreeBSD. Just doing
                      > "touch" on a file doesn't. If you know the low
                      > level implementation
                      > this is obvious: a directory holds the list of
                      > i-nodes, the i-node
                      > stores the info about the file. Thus only when you
                      > rename, remove or
                      > add a file the timestamp of the directory is
                      > changed. Not when you
                      > change the contents of a file.
                      >

                      It shouldn't matter what OS you're using. You're
                      changing content of a file not a directory. I've never
                      come across any OS that changes directory timestamp
                      when content of an existing file is changed.

                      So do you agree with me that when an existing file is
                      edited using Vim the directory timestamp shouldn't
                      change? If so would you be able to configure it,
                      without having to sacrifice swap file and backup file
                      (e.g., creat them somewhere else like /tmp)?

                      Cheers,
                      Robo.


                      > --
                      > From "know your smileys":
                      > (:-# Said something he shouldn't have
                      >
                      > /// Bram Moolenaar -- Bram@... --
                      > http://www.Moolenaar.net \\\
                      > /// Creator of Vim - Vi IMproved --
                      > http://www.Vim.org \\\
                      > \\\ Project leader for A-A-P --
                      > http://www.A-A-P.org ///
                      > \\\ Help AIDS victims, buy here:
                      > http://ICCF-Holland.org/click1.html ///


                      __________________________________
                      Do you Yahoo!?
                      The New Yahoo! Shopping - with improved product search
                      http://shopping.yahoo.com
                    • Bram Moolenaar
                      ... When you use a backup file in the same directory then Vim will create a new file, thus the directory will change. If you tell Vim not to use a backup
                      Message 10 of 18 , Oct 4, 2003
                      • 0 Attachment
                        Roboco Sanchez wrote:

                        > It shouldn't matter what OS you're using. You're
                        > changing content of a file not a directory. I've never
                        > come across any OS that changes directory timestamp
                        > when content of an existing file is changed.
                        >
                        > So do you agree with me that when an existing file is
                        > edited using Vim the directory timestamp shouldn't
                        > change? If so would you be able to configure it,
                        > without having to sacrifice swap file and backup file
                        > (e.g., creat them somewhere else like /tmp)?

                        When you use a backup file in the same directory then Vim will create a
                        new file, thus the directory will change. If you tell Vim not to use a
                        backup file, or put it somewhere else, Vim will overwrite the file and
                        the directory probably won't be changed. Same goes for the swap file.

                        I don't know what is so important about not changing the directory
                        though. I prefer to keep the backup and swap file together with the
                        original file.

                        --
                        From "know your smileys":
                        (X0||) Double hamburger with lettuce and tomato

                        /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
                        /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\
                        \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
                        \\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html ///
                      • Roboco Sanchez
                        ... The problem is Vim still causes directory timestamp to change even though you tell it to write backup file and swap file somewhere else. And that s why I
                        Message 11 of 18 , Oct 4, 2003
                        • 0 Attachment
                          --- Bram Moolenaar <Bram@...> wrote:
                          >
                          > Roboco Sanchez wrote:
                          >
                          > > It shouldn't matter what OS you're using. You're
                          > > changing content of a file not a directory. I've
                          > never
                          > > come across any OS that changes directory
                          > timestamp
                          > > when content of an existing file is changed.
                          > >
                          > > So do you agree with me that when an existing file
                          > is
                          > > edited using Vim the directory timestamp shouldn't
                          > > change? If so would you be able to configure it,
                          > > without having to sacrifice swap file and backup
                          > file
                          > > (e.g., creat them somewhere else like /tmp)?
                          >
                          > When you use a backup file in the same directory
                          > then Vim will create a
                          > new file, thus the directory will change. If you
                          > tell Vim not to use a
                          > backup file, or put it somewhere else, Vim will
                          > overwrite the file and
                          > the directory probably won't be changed. Same goes
                          > for the swap file.

                          The problem is Vim still causes directory timestamp to
                          change even though you tell it to write backup file
                          and swap file somewhere else. And that's why I came
                          here.

                          >
                          > I don't know what is so important about not changing
                          > the directory
                          > though. I prefer to keep the backup and swap file
                          > together with the
                          > original file.

                          Some people don't care about directory timestamp. But
                          some people do. Some people prefer backup and swap
                          file together with the original file. But some people
                          don't. It would be a long story to debate the
                          important of directory timestamp with those who don't
                          care about it.

                          Cheers,
                          Robo.

                          >
                          > --
                          > From "know your smileys":
                          > (X0||) Double hamburger with lettuce and tomato
                          >
                          > /// Bram Moolenaar -- Bram@... --
                          > http://www.Moolenaar.net \\\
                          > /// Creator of Vim - Vi IMproved --
                          > http://www.Vim.org \\\
                          > \\\ Project leader for A-A-P --
                          > http://www.A-A-P.org ///
                          > \\\ Help AIDS victims, buy here:
                          > http://ICCF-Holland.org/click1.html ///


                          __________________________________
                          Do you Yahoo!?
                          The New Yahoo! Shopping - with improved product search
                          http://shopping.yahoo.com
                        • David Brown
                          ... - Writing with a backup file temporarily creates a file in the directory. This touches the directory. - The swap file is created in the current directory.
                          Message 12 of 18 , Oct 4, 2003
                          • 0 Attachment
                            On Sat, Oct 04, 2003 at 04:20:36AM -0700, Roboco Sanchez wrote:

                            > - edit an existing file using any editor except Vim

                            - Writing with a backup file temporarily creates a file in the
                            directory. This touches the directory.
                            - The swap file is created in the current directory.

                            If you set 'backupdir' and 'directory' respectively, this can be written
                            to other directories. You probably will have to set backupcopy
                            otherwise it will try renaming the file, which will change the
                            directory.

                            BTW, Emacs, with its default options will also touch the directory. In
                            fact, it seems to leave its backup file around after the edit.

                            I think so many things inadventently touch directories that most people
                            don't consider the directory timestamp to be useful for much. I only
                            know of one backup software that even attempts to restore the directory
                            mtime. It has to do this as an extra step after the restore has
                            finished.

                            Dave
                          • David Brown
                            ... You probably forgot to set backupcopy=yes . Without that, vim still tries to rename, even if the backup file is in a different directory. I just tested
                            Message 13 of 18 , Oct 4, 2003
                            • 0 Attachment
                              On Sat, Oct 04, 2003 at 08:12:19AM -0700, Roboco Sanchez wrote:

                              > The problem is Vim still causes directory timestamp to
                              > change even though you tell it to write backup file
                              > and swap file somewhere else. And that's why I came
                              > here.

                              You probably forgot to 'set backupcopy=yes'. Without that, vim still
                              tries to rename, even if the backup file is in a different directory.

                              I just tested with

                              set backupdir=~/tmp
                              set directory=~/tmp
                              set backupcopy=yes

                              and Vim doesn't change the directory timestamp when I edit files.

                              Dave
                            • Roboco Sanchez
                              ... The archiver RAR and TAR both do restore directory timestamps. Let me try your solution, Dave. Cheers, Robo. __________________________________ Do you
                              Message 14 of 18 , Oct 4, 2003
                              • 0 Attachment
                                --- David Brown <vim@...> wrote:
                                > On Sat, Oct 04, 2003 at 04:20:36AM -0700, Roboco
                                > Sanchez wrote:
                                >
                                > > - edit an existing file using any editor except
                                > Vim
                                >
                                > - Writing with a backup file temporarily creates a
                                > file in the
                                > directory. This touches the directory.
                                > - The swap file is created in the current directory.
                                >
                                > If you set 'backupdir' and 'directory' respectively,
                                > this can be written
                                > to other directories. You probably will have to set
                                > backupcopy
                                > otherwise it will try renaming the file, which will
                                > change the
                                > directory.
                                >
                                > BTW, Emacs, with its default options will also touch
                                > the directory. In
                                > fact, it seems to leave its backup file around after
                                > the edit.
                                >
                                > I think so many things inadventently touch
                                > directories that most people
                                > don't consider the directory timestamp to be useful
                                > for much. I only
                                > know of one backup software that even attempts to
                                > restore the directory
                                > mtime. It has to do this as an extra step after the
                                > restore has
                                > finished.
                                >
                                > Dave

                                The archiver RAR and TAR both do restore directory
                                timestamps.

                                Let me try your solution, Dave.

                                Cheers,
                                Robo.


                                __________________________________
                                Do you Yahoo!?
                                The New Yahoo! Shopping - with improved product search
                                http://shopping.yahoo.com
                              • Roboco Sanchez
                                ... Dave, that s great! How could I miss that backupcopy! Many thanks to you, and to everyone else as well. Cheers, Robo. __________________________________ Do
                                Message 15 of 18 , Oct 4, 2003
                                • 0 Attachment
                                  --- David Brown <vim@...> wrote:
                                  > On Sat, Oct 04, 2003 at 08:12:19AM -0700, Roboco
                                  > Sanchez wrote:
                                  >
                                  > > The problem is Vim still causes directory
                                  > timestamp to
                                  > > change even though you tell it to write backup
                                  > file
                                  > > and swap file somewhere else. And that's why I
                                  > came
                                  > > here.
                                  >
                                  > You probably forgot to 'set backupcopy=yes'.
                                  > Without that, vim still
                                  > tries to rename, even if the backup file is in a
                                  > different directory.
                                  >
                                  > I just tested with
                                  >
                                  > set backupdir=~/tmp
                                  > set directory=~/tmp
                                  > set backupcopy=yes
                                  >
                                  > and Vim doesn't change the directory timestamp when
                                  > I edit files.
                                  >
                                  > Dave

                                  Dave, that's great! How could I miss that backupcopy!

                                  Many thanks to you, and to everyone else as well.

                                  Cheers,
                                  Robo.


                                  __________________________________
                                  Do you Yahoo!?
                                  The New Yahoo! Shopping - with improved product search
                                  http://shopping.yahoo.com
                                Your message has been successfully submitted and would be delivered to recipients shortly.