unixvimcommand-linedotfiles

Symlink dotfiles


I am having trouble symlinking dotfiles. I have a folder in my home directory ~/dotfiles which I have synced to a github repo. I am trying to take my .vimrc file in ~/dotfiles/.vimrc and create a symbolic link to put it at ~/.vimrc. To do this I type in

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

But when I run that it says

ln: /Users/me/.vimrc: File exists

What am I doing wrong?


Solution

  • That error message means that you already have a file at ~/.vimrc, which ln is refusing to overwrite. Either delete the ~/.vimrc and run ln again or let ln delete it for you by passing the -f option:

    ln -s -f ~/dotfiles/.vimrc ~/.vimrc