0

I want to rename my. ".vimrc" as "bob.vimrc"

And I want to put it inside "/Users/bob/bobs bits"

As you can tell, I'm on a Mac.

But everything keeps going wrong. I don't want a ".vimrc" symlink in ~, because bob wants all sorts of things in "bobs bits" in his folder - keys for vpns, encrypted text files etc, so he doesn't want the operating systems tentacles reaching into his stuff. He just wants to just move his "Bob's bits" to other systems.

Someone told me I could do: vim -u "/Users/bob/bobs bits/bob.vimrc" bobsnewfile. But his functions come out funny - vim types them out rather that executing them.

4
  • You can create a public part of vimrc in "bobs bits" folder then link vimrc to that file that call to private part of vimrc in "bobs bits" again. Commented Nov 19, 2017 at 16:03
  • Thanks for your idea Tuyen. But 'bob' isnt really concerned with security atm. And also, symlinking into "bobs bits" is what I'm trying to avoid. I want vim to be somehow configured to look for bob.vimrc within "bobs bits" without any symlinking into that folder
    – user251764
    Commented Nov 19, 2017 at 16:31
  • Maybe you should try to compile vim from sourcecode and change its default $VIMRC. Commented Nov 19, 2017 at 16:33
  • Now that is a nice idea. I would learn a lot too. But In l I'm still on my mission to do it an easier way - I'm sure there must be one
    – user251764
    Commented Nov 19, 2017 at 16:35

1 Answer 1

3

First off, you can place your vimrc contents in ~/.vim/vimrc (except on some platforms, see :h vimrc for specifics). If your goal is to eliminate the ~/.vim folder however, you will need to set the VIMINIT environment variable. This variable is an ex command line (series of ex commands separated by |) which are run when vim starts up. For example, you could use the following in your bashrc (setting environment variables is platform dependent, you should modify for your platform).

export VIMINIT="let \$MYVIMRC='XXXwhatever/vimrcXXX' | source \$MYVIMRC"

Where vim looks for your personal vimrc is well documented:

:h vimrc-intro, :h $VIM, :h startup, :h $MYVIMRC

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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