-1

I puts all my dotfiles in $HOME/Dropbox/dotfiles

and make a hard link(I think it's the way to go, and for instance vim does't load soft link rc file)

ln $HOME/Dropbox/dotfiles/.vimrc $HOME/.vimrc

The problem is as long as I make change to the file in the dropbox directories, everything works as expected. But when I change the hard link file(which is $HOME/.vimrc), the original file changes accordingly, but dropbox won't sync!!(same as iCloud mobile document folder)

Any idea?

mko
  • 21,334
  • 49
  • 130
  • 191

1 Answers1

1

Use soft links. Hard links make it so that Dropbox can't tell when the file is updated. This is because Dropbox doesn't poll the contents of every single file you have, it just looks at modification dates on the files located in your Dropbox.

This is exactly what I use for syncing my dot files with Dropbox:

$ ln -s ~/Dropbox/dotfiles/.vimrc .vimrc

and vim still loads the soft-linked vimrc file.

cronburg
  • 892
  • 1
  • 8
  • 24
  • Thanks Karl It works, but I just curious why `ls -s .vimrc $HOME/.vimrc`(currently in `$HOME/Dropbox/dotfiles` folder) doesn't work – mko Dec 30 '13 at 10:54
  • 1
    the first argument to `ln` is TARGET and the second is LINK_NAME, meaning for the command you just gave, linux creates a link at $HOME/.vimrc pointing to "-> .vimrc" which it assumes to be in the same directory (in $HOME). so the first argument is *always* relative to the directory the link is in, not the directory you create the link in. – cronburg Jan 01 '14 at 00:58
  • as a rule of thumb I always run ln as `ln ./path/to/target/file file` from within the directory I want the link. – cronburg Jan 01 '14 at 01:03