Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've got a symlinked .vimrc:

simont@charmander ~/repositories/config-files [master *]
± $ ls -l ~/.vimrc
lrwxr-xr-x  1 simont  admin  6  9 May 17:14 /Users/simont/.vimrc -> .vimrc

However, vim doesn't load it on startup.

When I run :echo $MYVIMRC from vim, it returns empty.

I'm not using any alias' for vim:

simont@charmander ~/repositories/config-files [master *]
± $ alias | grep vim

simont@charmander ~/repositories/config-files [master *]

There's a bunch of questions that seem to suggest that this should be working for me. Is there a particular flag I should pass to vim on startup to get it to follow symlinks? I'm stumped.

share|improve this question
up vote 9 down vote accepted

Symlink targets can be either absolute (starting with /) or relative to the symlink's location. Since the symlink is located in /Users/simont/ and has ".vimrc" as its target, it is essentially pointing to itself.

Try recreating the symlink using a correct path: (note that the target is stored in the symlink exactly as given in command line, without considering $PWD)

  • Relative:

    ln -sf repositories/config-files/.vimrc ~/.vimrc
    
  • Absolute:

    ln -sf ~/repositories/config-files/.vimrc ~/.vimrc 
    

(No, I don't know why it works when opened for editing...)

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .