Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I always put a .vimrc in my home folder for turning :syntax on. But in OS X Lion it seems that sudo vi foo.txt ignore or can't find this vim configuration anymore.

Has anyone experiences the same thing?

share|improve this question

3 Answers 3

up vote 2 down vote accepted

Try doing sudo visudo and making sure that this lines appears somewhere in there:

Defaults  env_keep += "HOME"

This should maintain the HOME directory and ~ should would as it did in Snow Leopard.

share|improve this answer
    
Works great! Thank you. –  Dali Aug 9 '11 at 9:50

I usually have use the same .vimrc and .vim folders as my main users and link them to a safe backupped place on Dropbox - wich btw is awesome for this kind of task.

The location of the home folder for your su is /var/root. Therefore .vimrc and the .vim folder belong there.

share|improve this answer
    
Thanks, good idea! :) Would like to mark your answer as correct, too. –  Dali Aug 9 '11 at 9:47

Try using vim instead of vi. Sometimes the default for "vi" is compatibility mode. Not sure if this is the case with Lion, however.

share|improve this answer

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.