Add the lptag function to add a prefix

Note: the `lptag` function is  convenient way to add a prefix. You can thus add
a keyword to your different terminals:

    [:~/code/liquidprompt] develop ± lptag mycode
    mycode [:~/code/liquidprompt] develop ±
This commit is contained in:
nojhan 2013-02-26 13:37:31 +01:00
parent c88ebf656e
commit 31caf8a72d
2 changed files with 15 additions and 2 deletions

View File

@ -65,9 +65,10 @@ changes have been made and the number of pending commits, if any;
* a red star if there is some untracked files in the repository; * a red star if there is some untracked files in the repository;
* the error code of the last command, if it has failed in some way; * the error code of the last command, if it has failed in some way;
* a smart mark: ± for git directories, ☿ for mercurial, ‡ for svn, ⌘ * a smart mark: ± for git directories, ☿ for mercurial, ‡ for svn, ⌘
for fossil, $ for simple user, a red # for root. for fossil, $ for simple user, a red # for root;
* if you ask for, the liquidprompt will be replicated in your terminal window's * if you ask for, the liquidprompt will be replicated in your terminal window's
title (without the colors) title (without the colors);
* you can easily add a prefix tag to your prompt, by invoking `lptag MYTAG`.
You can temporarily deactivate the liquid prompt and come back to your previous You can temporarily deactivate the liquid prompt and come back to your previous
one by typing `prompt_off`. Use `prompt_on` to bring it back. You can deactivate one by typing `prompt_off`. Use `prompt_on` to bring it back. You can deactivate
@ -157,6 +158,13 @@ You can prefix the `LP_PS1` variable with anything you want using the
LP_PS1_PREFIX="\[\e]0;\u@\h: \w\a\]" LP_PS1_PREFIX="\[\e]0;\u@\h: \w\a\]"
Note: the `lptag` function is convenient way to add a prefix. You can thus add
a keyword to your different terminals:
[:~/code/liquidprompt] develop ± lptag mycode
mycode [:~/code/liquidprompt] develop ±
### PUT THE PROMPT IN A DIFFERENT ORDER ### PUT THE PROMPT IN A DIFFERENT ORDER
You can sort what you want to see by sourcing your favorite template file You can sort what you want to see by sourcing your favorite template file

View File

@ -1311,6 +1311,11 @@ _lp_set_prompt()
fi fi
} }
lptag()
{
export LP_PS1_PREFIX=$(_lp_sr "$1")
}
# Activate the liquid prompt # Activate the liquid prompt
prompt_on() prompt_on()
{ {