Friday, August 24, 2012

Re: How to use virtualenv in Vim ?

Excerpts from [ Benjamin R. Haskell ] //// On [2012-08-24 11:57:46 -0400]:

> On Fri, 24 Aug 2012, chris wrote:

> >I added plugin virtualenv
> >(https://github.com/jmcantrell/vim-virtualenv) into my runtimepath.

> >I'm new to virtualenv. The Vim plugin virtualenv has a function for
> >statusline show the virutalenv name. I added it into my statusline
> >option like this:
> > set statusline+=\ \%{virtualenv#statusline()}

> You shouldn't set that. Powerline makes the 'statusline' option
> irrelevant.
Because I found Powerline cann't display that in statusline, so I try to test
whether virtualenv#statusline() will show in statusline without Powerline.


> >And I also add this virtualenv segment into Powerline statusline.
> > call Pl#Theme#InsertSegment('virtualenv', 'after', 'hgrev')

> Powerline already has built-in support for virtualenv. But, if
> you're using a non-standard theme or something, your call should be:

> call Pl#Theme#InsertSegment('%{virtualenv#statusline()}', 'after', 'hgrev')


> >I execute some commands:
> > $ virtualenv test
> > $ source bin/activate
> > $ python bin/activate_this.py
> > $ vim test.py
> >Then I do not see the virtualenv name in statusline, both original
> >statusline and Powerline statusline.

> Virtualenv requires a Vim with Python support. Run: :version and
> look for +python in the output. If it's not there, virtualenv won't
> work. Based on the Powerline condition for including it¹, try (all
> one line):

> :echo has('python') && (exists('g:virtualenv_loaded') && g:virtualenv_loaded == 1)
This command shows 1. all of those conditions are satisfied.

> --
> Best,
> Ben H

> ¹: https://github.com/Lokaltog/vim-powerline/blob/develop/autoload/Powerline/Segments/virtualenv.vim

> --
> You received this message from the "vim_use" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php

--
[ stardiviner ] ^^&^^ {I hate all of you ! Leave me alone}
IRC(freenode): stardiviner \\ Twitter: @numbchild \\
GnuPG Key fingerprint
>>> 9BAA 92BC CDDD B9EF 3B36 CB99 B8C4 B8E5 47C3 2433

No comments: