The One About The Dynamic Duo
I have been using TextMate for a long time. It is one of the best text editors out there for macOS (Yes, it is better than the crapfest that is SourceKit used in Xcode) and has a long list of useful bundles. Today, I want to highlight a feature that is lacking (or I don’t know how to use it, and if you know, please help!) in TextMate, and my ode to TextMate will take shape as another story another day.
Python and virtualenv are at the core of my development stack. It just so happens that TextMate lacks the ability to recognize if a project you are working on is using a virtual environment. So how do you tell TextMate to use the virtual environment?
While not elegant, the answer is simple. In your project’s root directory, create a file called .tm_properties
. This is a file that TextMate uses, if one exists, to load configurations for the current project.
In the .tm_properties
file, add the following line:
TM_PYTHON = '$HOME/.virtualenvs/dynamicduo/bin/python'
In the above .virtualenvs
is where I create all my virtual environments, so that may be different for you, depending on where you create your virtual environments.
There you have it. Now TextMate recognizes your virtual environment.