arialdomartini / oh-my-git

An opinionated git prompt for bash and zsh

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

show virtualenv breaks new line in terminal. Code fix include

mateuspadua opened this issue · comments

I enabled the function omg_prompt_callback to show current virtualenv in ubuntu and this dont leave terminal create new line, how in the image below.

screenshot from 2015-06-20 15 55 36

I copied this script to my .bashrc

VIRTUAL_ENV_DISABLE_PROMPT=true
function omg_prompt_callback() {
    if [ -n "${VIRTUAL_ENV}" ]; then
        echo "\e[0;31m(`basename ${VIRTUAL_ENV}`)\e[0m "
    fi
}

To fix this i changed the code above for code below:

VIRTUAL_ENV_DISABLE_PROMPT=true
function omg_prompt_callback() {
    RED='\[\033[31m\]'
    if [ -n "${VIRTUAL_ENV}" ]; then
        echo "${RED}(${VIRTUAL_ENV##*/}) "
    fi
}

Thanks and i hope it helps

how did you do the color conversion from \e[0;31m to \[\033[31m\]?

Hello, atav32, but i picked this color in web. sorry for not being able to help

commented

This really solved the problem on Ubuntu 16.04