File tree Expand file tree Collapse file tree 5 files changed +38
-1
lines changed
Expand file tree Collapse file tree 5 files changed +38
-1
lines changed Original file line number Diff line number Diff line change 11Changelog
22=========
33
4- ## 2011-10-18 0.2.5
4+ ## 2011-10-18 0.2.6
55-------------------
66* Add <C-space> shortcut for macvim users.
7+ * Add VIRTUALENV support
78
89## 2011-10-17 0.2.4
910-------------------
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ There is no need to install the pylint_ or rope_ library on your system.
1515- Run python code
1616- Go to definition
1717- Powerful customization
18+ - Virtualenv support
1819- And more...
1920
2021See screencast here: http://t.co/3b0bzeXA (sorry for quality, this my first screencast)
@@ -151,6 +152,9 @@ Default values: ::
151152 " Autoremove unused whitespaces
152153 let g:pymode_utils_whitespaces = 1
153154
155+ " Auto fix vim python paths if virtualenv enabled
156+ let g:pymode_virtualenv = 1
157+
154158.. note :: See also :help ropevim.txt
155159
156160
Original file line number Diff line number Diff line change 1+ " OPTION: g:pymode_lint -- bool. Load pylint plugin
2+ call helpers#SafeVar (" g:pymode_virtualenv" , 1 )
3+
4+ " DESC: Disable script loading
5+ if ! g: pymode_virtualenv || ! g: pymode
6+ let g: pymode_virtualenv = 0
7+ finish
8+ endif
9+
10+ fun ! pymode_virtualenv#Activate () " {{{
11+ python << EOF
12+ ve_dir = os.environ [' VIRTUAL_ENV' ]
13+ ve_dir in sys.path or sys.path .insert (0 , ve_dir)
14+ activate_this = os.path .join (os.path .join (ve_dir, ' bin' ), ' activate_this.py' )
15+ execfile (activate_this, dict (__file__= activate_this))
16+ EOF
17+ endfunction " }}}
Original file line number Diff line number Diff line change @@ -62,6 +62,8 @@ PythonMode. These options should be set in your vimrc.
6262
6363| 'pymode_utils' | Turns off utils
6464
65+ | 'pymode_virtualenv' | Turns off virtualenv
66+
6567| 'pymode_utils_whitespaces' | Remove unused whitespaces
6668
6769
@@ -171,6 +173,13 @@ Default: 1.
171173
172174If this option is set to 0 then utils script is disabled.
173175
176+ ------------------------------------------------------------------------------
177+ *'pymode_virtualenv'*
178+ Values: 0 or 1.
179+ Default: 1.
180+
181+ If this option is set to 0 then virtualenv support is disabled.
182+
174183------------------------------------------------------------------------------
175184 *'pymode_utils_whitespaces'*
176185Values: 0 or 1.
Original file line number Diff line number Diff line change @@ -20,6 +20,12 @@ if g:pymode
2020
2121endif
2222
23+ " Add virtualenv paths
24+ if g: pymode_virtualenv && exists (" $VIRTUAL_ENV" )
25+ echomsg " Enabled virtualenv: " . $VIRTUAL_ENV
26+ call pymode_virtualenv#Activate ()
27+ endif
28+
2329" Python documentation
2430if g: pymode_doc
2531
You can’t perform that action at this time.
0 commit comments