Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

i dont see the behavior you describe after i edit file in vim the inode does not change (in linux)

  → ls  -i /tmp/foo2.txt 
  4063325 /tmp/foo2.txt
  → vim !$
  vim /tmp/foo2.txt #edit file
  → ls  -i /tmp/foo2.txt 
  4063325 /tmp/foo2.txt


It depends on vim's 'writebackup' option. By default, it's on, but I guess you have it off. You can check in vim with ":set writebackup?" If it returns "writebackup", it's on; if it returns "nowritebackup", it's off.

EDIT: Then again, like the other comment mentioned, it seems it also depends on whether the file is in /tmp/. This seems to be because it matches the default pattern in the option "backupskip". For unix, the default is "/tmp/,$TMPDIR/,$TMP/,$TEMP/".


Thanks. Very curious. Indeed if the file is in /tmp, the inode doesn't change. But if it's in my home directory, it does change (for me). Both file systems are ext4, so there's something else at play.


in /tmp you dont have write permissions (so cannot create a new file, and falls back to overwrite), in home directory you have.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: