arialdomartini / oh-my-git-themes

Themes of the ZSH version of oh-my-git prompt
27 stars 42 forks source link

oppa-lana-style uses the prompt callback function to inject generic strings #2

Open arialdomartini opened 9 years ago

arialdomartini commented 9 years ago

This PL is aimed to solve the issue #38. It depends on the PL https://github.com/arialdomartini/oh-my-git/pull/40 of oh-my-git, since it relies on two functions defined in base.sh

This PL makes the oppa-lana-style theme use the prompt callback function omg_prompt_callback, which can be used to define a generic segment to be displayed in the second line of the prompt.

Please, refer to the documentation in https://github.com/arialdomartini/oh-my-git/pull/40

Since colors in zsh are managed slightly differently than in bash, the callback function aimed to inject the virtualenv name is also a bit different. The following snipped can be used in .zshrc

VIRTUAL_ENV_DISABLE_PROMPT=true
function omg_prompt_callback() {
    if [ -n "${VIRTUAL_ENV}" ]; then
        echo "%F{white}(`basename ${VIRTUAL_ENV}`)%f "
    fi
}

When inside a virtualenv, this results in the prompt

screen shot 2015-01-22 at 09 32 03

rather that the prompt

screen shot 2015-01-22 at 08 57 08

eaybek commented 8 years ago

this branch need a merge with master again. master isn't contains theese lines (spesificly eval_prompt_callback commits)

rcmachado commented 8 years ago

Tested locally and looks like this PR can be merged onto master.

There is something else that needs to be done to merge and close this PR?