Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

1 Answer

up vote 3 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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.