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 support for Python's virtualenvs #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions fish_right_prompt.fish
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# set theme_display_rbenv 'yes' (config.fish)
# set theme_display_rbenv_gemset 'yes' (config.fish)
# set theme_display_rbenv_with_gemfile_only 'yes' (config.fish)
# set theme_display_venv 'yes' (config.fish)

function _ruby_version
echo (command rbenv version-name | sed 's/\n//')
Expand All @@ -11,6 +12,15 @@ function _ruby_gemset
echo (command rbenv gemset active ^/dev/null | sed -e 's| global||')
end

function _show_venv
if [ "$VIRTUAL_ENV" ]
if [ "$theme_display_rbenv" = 'yes' ]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo/copypasta here.

edit: just kidding! i see what you did here :P

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that was sadly an evil branch I couldn't really get rid of, sadly :)

echo -n " "
end
echo -n -s (set_color green) (basename $VIRTUAL_ENV) (set_color normal)()
end
end

function fish_right_prompt
if [ "$theme_display_rbenv" = 'yes' ]
set -l red (set_color red)
Expand All @@ -34,4 +44,8 @@ function fish_right_prompt
echo -n -s $ruby_info $normal
end
end

if [ "$theme_display_venv" = 'yes' ]
_show_venv
end
end
16 changes: 15 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ $ omf theme l
## Configuration

Only if fish_theme_l_right_prompt variable is set true within config.fish:

### rbenv support

```fish
set theme_display_rbenv 'yes'
set theme_display_rbenv_gemset 'yes'
Expand All @@ -44,6 +47,17 @@ set theme_display_rbenv_with_gemfile_only 'yes'
<img src="http://f.cl.ly/items/0f0k3o2L3y2q1L3g1R1X/5.png">
</p>


### Python venv support

If you're using [virtualfish][] and enable the `theme_display_venv` setting with
the following line in your `config.fish`, the currently active virtualenv is
part of the right-side-prompt, highlighted in green:

```fish
set theme_dispay_venv 'yes'
```

# License

[MIT][mit] © [bpinto][author] et [al][contributors]
Expand All @@ -57,4 +71,4 @@ set theme_display_rbenv_with_gemfile_only 'yes'
[license-badge]: https://img.shields.io/badge/license-MIT-007EC7.svg?style=flat-square
[travis-badge]: http://img.shields.io/travis/oh-my-fish/theme-default.svg?style=flat-square
[travis-link]: https://travis-ci.org/oh-my-fish/theme-default

[virtualfish]: https://github.com/adambrenecki/virtualfish