linux/vim lifehack: sourcing a temporary local environment

10 Dec 2016 17:18 | vim

If you’re a vim fanboy like me you may often find it frustrating when logging into another machine that the default vim config isn’t very nice to use. Sometimes the remote machine has a shared user account so changing it to your liking isn’t really practical.

To work around this and make my life easier I created this:

https://a.rkw.io/env-nonstatic

which I can source from any linux machine to instantly give me a sane but still temporary vim config. It first sources the .bash_profile so we have anything that we might need from there, then processes all of my personal environment config. Vim is alias’d to load a temporary config file stored in /tmp so I can use my own config for the remainder of the session without affecting other users.

To make this even more useful I use the awesome program TextExpander from Smile Software which allows you to make system-wide keyboard snippets that expand into useful macros. So now all I have to type on any linux machine I log into it:

;env

and it will automatically expand to:

. <(curl https://a.rkw.io/env-nonstatic 2>/dev/null)

and it even presses enter for me :) How cool is that?