3 ms·
/.bashrc -> ~/Dropbox/.bashrc ~/.vim -> ~/Dropbox/.vim/ That works for directories, but not for files such as ~/.bashprofile, if tools update such files by
by Someone 7y ago
/.bashrc -> ~/Dropbox/.bashrc
~/.vim -> ~/Dropbox/.vim/
That works for directories, but not for files such as ~/.bashprofile, if tools update such files by
- writing the updated file under a different name
- deleting the old file
- renaming the updated file
as the second step would delete the link (or fail; I’m not too familiar with the UNIX APIs)
(I think that’s a fairly common strategy. I tried checking whether vim uses it, but got lost in https://github.com/vim/vim/blob/master/src/fileio.c; https://github.com/vim/vim/blob/master/src/fileio.c; that file is too large to comfortably read on an iPad (try guessing how many lines of C it takes to ”Read lines from file "fname" into the buffer after line "from"”)
- codetrotter 7y agoI’ve used symlinked bashrc and other files and edited them with Vim through their symlinks and never had the sorts of problem you theorized about. I would consider the behavior you outline to be an editor bug. Symlinks are pretty important and any editor that would destroy a symlink and replace it with a regular file is clearly misbehaving software IMO.