Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Here's what I use (sorry the highlighting is screwy).</p> <pre><code>" Function to activate a virtualenv in the embedded interpreter for " omnicomplete and other things like that. function LoadVirtualEnv(path) let activate_this = a:path . '/bin/activate_this.py' if getftype(a:path) == "dir" &amp;&amp; filereadable(activate_this) python &lt;&lt; EOF import vim activate_this = vim.eval('l:activate_this') execfile(activate_this, dict(__file__=activate_this)) EOF endif endfunction " Load up a 'stable' virtualenv if one exists in ~/.virtualenv let defaultvirtualenv = $HOME . "/.virtualenvs/stable" " Only attempt to load this virtualenv if the defaultvirtualenv " actually exists, and we aren't running with a virtualenv active. if has("python") if empty($VIRTUAL_ENV) &amp;&amp; getftype(defaultvirtualenv) == "dir" call LoadVirtualEnv(defaultvirtualenv) endif endif </code></pre> <p>Note that you need to have MacVim compiled against the Python you are using for the virtualenv, e.g. if you downloaded Python 2.7 from Python.org you should recompile MacVim using <code>--with-python-config-dir=/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config</code> as an argument to <code>./configure</code>.</p> <p>Hope that helps!</p> <p><strong>EDIT:</strong> Just one note of attribution: A lot of the detective work that went into writing this little ditty was done by <a href="http://blog.roseman.org.uk/2010/04/21/vim-autocomplete-django-and-virtualenv/">this blogger</a>, and he deserves some of the credit.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload