Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add python virtual env support #37

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Add python virtual env support #37

wants to merge 4 commits into from

Conversation

davepwsmith
Copy link
Contributor

I wanted to add a plugin for virtualenv support which followed the convention of adding in [ ] before the prompt. To do this I needed to insert after the newline and before the lambda - the easiest way of doing this was to split the closePrompt function in two, so that plugins could be registered between.

@mattdkerr
Copy link
Contributor

why put it before the prompt instead of inside of the powerline?

@davepwsmith
Copy link
Contributor Author

Just seemed like the done thing when I have had similar venv prompt indicators before... Would be easy too just to add it as a segment, I guess, but would need to somehow very clearly separate it from the other indicators (git etc.)

@AmrEldib
Copy link
Owner

AmrEldib commented Jun 8, 2018

A Python segment would look separate from the Git segment if used a distinct color. See the available colors in the table.
It can also has a symbol in front of it like the npm segment has an option for that.

If the Python needs to be shown before the Git segment, this can be done via the number passed to the register_filter function, like here. The lower the number, the earlier the segment.

I think a Python segment would also need to have an option to only show up when there's a py file in the folder. A user can choose to show the segment all the time as well.

@davepwsmith
Copy link
Contributor Author

davepwsmith commented Jun 11, 2018

How about this then?

  • Virtual env displays after the folder and before the git in the powerline
  • There is an option (added to config sample) to show always or only when python files are present
  • It uses the same colours as the NPM prompt, which might not be ideal in some (rare?) situations where people are using python and node in the same directory. Blue and Yellow are the python colours but those are used by the git prompt.

@AmrEldib AmrEldib self-assigned this Jul 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants