Display Python virtual environment
This commit is contained in:
parent
79774f544d
commit
a5a75f0507
1 changed files with 30 additions and 1 deletions
31
spp.pl
31
spp.pl
|
@ -19,6 +19,7 @@ our %CONFIG = (
|
||||||
'userhost' ,
|
'userhost' ,
|
||||||
#'load' ,
|
#'load' ,
|
||||||
#'prevcmd' ,
|
#'prevcmd' ,
|
||||||
|
#'pyenv' ,
|
||||||
#'git' ,
|
#'git' ,
|
||||||
] ,
|
] ,
|
||||||
# - Section generator for the central part of the top bar (undef if unused)
|
# - Section generator for the central part of the top bar (undef if unused)
|
||||||
|
@ -29,6 +30,7 @@ our %CONFIG = (
|
||||||
#'userhost' ,
|
#'userhost' ,
|
||||||
'load' ,
|
'load' ,
|
||||||
#'prevcmd' ,
|
#'prevcmd' ,
|
||||||
|
'pyenv' ,
|
||||||
'git' ,
|
'git' ,
|
||||||
] ,
|
] ,
|
||||||
# - Section generators for the input bar
|
# - Section generators for the input bar
|
||||||
|
@ -37,6 +39,7 @@ our %CONFIG = (
|
||||||
#'userhost' ,
|
#'userhost' ,
|
||||||
#'load' ,
|
#'load' ,
|
||||||
'prevcmd' ,
|
'prevcmd' ,
|
||||||
|
#'pyenv' ,
|
||||||
#'git' ,
|
#'git' ,
|
||||||
] ,
|
] ,
|
||||||
# - Always generate input line?
|
# - Always generate input line?
|
||||||
|
@ -68,7 +71,7 @@ our %CONFIG = (
|
||||||
# - Display OK/failed symbol?
|
# - Display OK/failed symbol?
|
||||||
pcmd_show_symbol => 1 ,
|
pcmd_show_symbol => 1 ,
|
||||||
# - Display status code? 0=no, 1=always, 2=on failure
|
# - Display status code? 0=no, 1=always, 2=on failure
|
||||||
pcmd_show_code => 1 ,
|
pcmd_show_code => 2 ,
|
||||||
# - Pad status code display? 0 = no, -1 = left aligned, 1 = right aligned
|
# - Pad status code display? 0 = no, -1 = left aligned, 1 = right aligned
|
||||||
pcmd_pad_code => -1 ,
|
pcmd_pad_code => -1 ,
|
||||||
# Success/failure colors for 0=nothing, 1=symbol, 2=code, 3=both
|
# Success/failure colors for 0=nothing, 1=symbol, 2=code, 3=both
|
||||||
|
@ -227,6 +230,10 @@ $THEMES{powerline_yb} = {
|
||||||
git_stash_symbol => '‡' ,
|
git_stash_symbol => '‡' ,
|
||||||
git_stash_bg => thref( 'bg1' ) ,
|
git_stash_bg => thref( 'bg1' ) ,
|
||||||
git_stash_fg => thref( 'fg1' ) ,
|
git_stash_fg => thref( 'fg1' ) ,
|
||||||
|
|
||||||
|
# Python virtual environment section colors
|
||||||
|
pyenv_bg => -1 ,
|
||||||
|
pyenv_fg => -1 ,
|
||||||
};
|
};
|
||||||
|
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
|
@ -850,3 +857,25 @@ sub render_git
|
||||||
@out = ( @out , _render_git_stash ) if $CONFIG{git_show_stash};
|
@out = ( @out , _render_git_stash ) if $CONFIG{git_show_stash};
|
||||||
return @out;
|
return @out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# PYTHON VIRTUAL ENVIRONMENT
|
||||||
|
|
||||||
|
sub render_pyenv
|
||||||
|
{
|
||||||
|
return () unless $ENV{VIRTUAL_ENV} || $ENV{CONDA_DEFAULT_ENV};
|
||||||
|
my $env;
|
||||||
|
if ( $ENV{VIRTUAL_ENV} ) {
|
||||||
|
$env = $ENV{VIRTUAL_ENV};
|
||||||
|
} else {
|
||||||
|
$env = $ENV{CONDA_VIRTUAL_ENV};
|
||||||
|
}
|
||||||
|
$env =~ s!.*/!!;
|
||||||
|
return {
|
||||||
|
bg => themed 'pyenv_bg' ,
|
||||||
|
content => [
|
||||||
|
{fg=>themed 'pyenv_fg'} ,
|
||||||
|
'PY:' . $env
|
||||||
|
] ,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue