Merged from main project

This commit is contained in:
Austen Adler 2015-01-05 16:40:12 -05:00
commit c4ca0b1093
6 changed files with 226 additions and 223 deletions

View File

@ -34,7 +34,7 @@ How to do the right thing?
# Hack, commit, hack, commit... # Hack, commit, hack, commit...
# Fork the project on Github (if you haven t yet) # Fork the project on GitHub (if you haven't yet)
# Add the remote target for pushes # Add the remote target for pushes
$ git remote add github git@github.com:$GITHUB_USER/liquidprompt.git $ git remote add github git@github.com:$GITHUB_USER/liquidprompt.git
@ -44,19 +44,21 @@ How to do the right thing?
# Rebase your work on the latest state of `develop` # Rebase your work on the latest state of `develop`
$ git rebase upstream/develop $ git rebase upstream/develop
# Push # Push your commits
$ git push github fix/my-fix $ git push github fix/my-fix
$ git push github fix/my-feature $ git push github fix/my-feature
# Create the pull request on Github. Check that Github choose the `develop` # Create the pull request on GitHub. Check that Github chose the `develop`
# branch as the starting point for your branch. # branch as the starting point for your branch.
How to make a good pull request? How to make a good pull request?
-------------------------------- --------------------------------
1. Check that your git settings for authorship are right: 1. Check that your Git authorship settings are correct:
$ git config -l | grep ^user\.
$ git config -l | grep ^user\.
2. All the commits in the pull request must be on the same topic. If instead 2. All the commits in the pull request must be on the same topic. If instead
you propose fixes on different topics, use separate branches in your repo you propose fixes on different topics, use separate branches in your repo
and make a pull request for each. and make a pull request for each.
@ -65,8 +67,8 @@ How to make a good pull request?
- second line must be empty - second line must be empty
- following lines (72 chars max) are optional and take this space freely - following lines (72 chars max) are optional and take this space freely
to express what that changes does. to express what that changes does.
Use references to Github issues number (ex: `#432`) if applicable Use references to GitHub issues number (ex: `#432`) if applicable
4. Use a good title for your pull request 4. Use a good title for your pull request.
5. Put details, web links, in the pull request body. Use Markdown fully to 5. Put details, web links, in the pull request body. Use Markdown fully to
format the content (see format the content (see
[Markdown syntax](http://daringfireball.net/projects/markdown/syntax)). [Markdown syntax](http://daringfireball.net/projects/markdown/syntax)).
@ -100,7 +102,7 @@ between pings: 1 week, 2 weeks, then every month.
If a stable version is released while your pull request has still not been If a stable version is released while your pull request has still not been
merged on any working branch of the main repo, it would be helpful to ease merged on any working branch of the main repo, it would be helpful to ease
the maitainer's work by rebasing your branch on top of the latest `develop` the maitainer's work by rebasing your branch on top of the latest `develop`
and push it again to your Github repo. Be careful (for example create a and push it again to your GitHub repo. Be careful (for example create a
branch or a tag before your rebase) because your may lose all your work in branch or a tag before your rebase) because your may lose all your work in
that process. that process.

363
README.md
View File

@ -1,203 +1,203 @@
Liquid prompt — A useful adaptive prompt for Bash & Zsh Liquid Prompt — a useful adaptive prompt for Bash & zsh
======================================================== =======================================================
Liquid prompt gives you a nicely displayed prompt with useful information Liquid Prompt gives you a nicely displayed prompt with useful information
when you need it. It shows you what you need when you need it. when you need it. It shows you what you need when you need it.
You will notice what changes, when it changes saving time and frustration. You will notice what changes *when* it changes, saving time and frustration.
And you can even use it with your favorite shell, Bash or Zsh. You can even use it with your favorite shell Bash or zsh.
![Screenshot](https://raw.github.com/nojhan/liquidprompt/master/demo.png) ![Screenshot](https://raw.github.com/nojhan/liquidprompt/master/demo.png)
## FEATURES
If there is nothing special in the current context, the liquid prompt is close ## Features
to a default prompt:
If there is nothing special about the current context, the appearance of Liquid
Prompt is similar to that of a default prompt:
`[user:~] $ ` `[user:~] $ `
If you are running a command in the background that is still running and you are If you are running a background command and are also in the "myb" branch
in a git repository on a server, on branch "myb": of a Git repository on a server:
`1r [user@server:~/liquidprompt] myb ± ` `1r [user@server:~/liquidprompt] myb ± `
A liquid prompt displaying everything (a rare event!) may look like this: When Liquid Prompt is displaying everything (a rare event!), it may look like this:
`code 🕤 ⌁24% ⌂42% 3d/2&/1z [user@server:~/ … /code/liquidprompt][pyenv]↥ master(+10/-5,3)*+ 125 ± ` `code 🕤 ⌁24% ⌂42% 3d/2&/1z [user@server:~/ … /code/liquidprompt][pyenv]↥ master(+10/-5,3)*+ 125 ± `
It (may) display: Here is an overview of what Liquid Prompt is capable of displaying:
* A tag associated to the current shell session (you can easily add any * a tag associated to the current shell session (you can easily add any
prefix tag to your prompt, by invoking `prompt_tag MYTAG`). prefix tag to your prompt by invoking `prompt_tag MYTAG`)
* The current time, either as numeric values or an analog clock, * the current time, displayed as either numeric values or as an analog clock
* a green ⏚ if the battery is charging, above the given threshold, but not charged, * the current battery status:
a yellow ⏚ if the battery is charging and under threshold, * a green `⏚` if charging, above the given threshold, but not charged
a yellow ⌁ if the battery is discharging but above threshold, * a yellow `⏚` if charging and under the given threshold
a red ⌁ if the battery is discharging and under threshold; * a yellow `⌁` if discharging but above the given threshold
* the average of the batteries remaining power, if it is under the given * a red `⌁` if discharging and under the given threshold
threshold, with a colormap, going more and more red with decreasing power; * the remaining battery power if it is under the given threshold, displayed with
* the average of the processors load, if it is over a given limit, with a an increasingly red color map as remaining power decreases
colormap that becomes more and more noticeable with increasing load; * the average of the processors load if it is over a given limit, displayed with
* the average temperature of the available sensors in the system (generally CPU an intensity color map as load increases
and MB); * the average temperature of the available system sensors (generally CPU and MB)
* the number of detached sessions (`screen` or `tmux`), if there are any; * the number of detached sessions (`screen` or `tmux`)
* the number of attached sleeping jobs (when you interrupt a command with Ctrl-Z * the number of attached sleeping jobs (when you interrupt a command with Ctrl-Z
and bring it back with `fg`), if there are any; and bring it back with `fg`)
* the number of attached running jobs (commands started with a `&`), if there are * the number of attached running jobs (commands started with a `&`)
any;
* a pair of square brackets, in blue if your current shell is running in a * a pair of square brackets, in blue if your current shell is running in a
terminal multiplexer (`screen` or `tmux`); terminal multiplexer (`screen` or `tmux`)
* the current user, in bold yellow if it is root, in light white if it is not * the current user, in bold yellow if it is root and in light white if it is not
the same as the login user; the same as the login user
* a green @ if the connection has X11 support, a yellow one if not; * a green `@` if the connection has X11 support; a yellow one if not
* the current host, if you are connected via a telnet connection (in bold red) * the current host in bold red if you are connected via a `telnet` connection
or SSH (either a blue hostname or different colors for different hosts); and blue (or other unique colors) if connected via SSH
* a green colon if the user has write permissions on the current directory, * a green colon if the user has write permissions in the current directory and
a red one if he has not; a red one if not
* the current directory in bold, shortened if it takes too much space, while * the current directory in bold, shortened if it takes too much space while always
preserving the first two directories; preserving the first two directory names
* the current Python virtual environment, if any; * the current Python virtual environment
* an up arrow if an HTTP proxy is in use; * an up arrow if an HTTP proxy is in use
* the name of the current branch if you are in a version control repository * the name of the current branch if you are in a version control repository
(git, mercurial, subversion, bazaar or fossil), in green if everything is up (Git, Mercurial, Subversion, Bazaar, or Fossil):
to date, in red if there are changes, in yellow if there are pending * in green if everything is up-to-date
commits to push; * in red if there are changes
* in yellow if there are pending commits to push
* the number of added/deleted lines if changes have been made and the * the number of added/deleted lines if changes have been made and the
number of pending commits, if any; number of pending commits
* a yellow plus if there is stashed modifications; * a yellow `+` if there are stashed modifications
* a red star if there is some untracked files in the repository; * a red `*` if there are untracked files in the repository
* the runtime of the last command, if it has exceeded a certain threshold; * the runtime of the last command, if it has exceeded a certain threshold
* 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 at the end of the prompt:
‡± for git-svn, ⌘ for fossil, $ or % for simple user, a red # for root; * `±` for Git
* if you ask for, the liquidprompt will be replicated in your terminal window's * `☿` for Mercurial
title (without the colors); * `‡` for Subversion
* `‡±` for Git-Subversion
* `⌘` for Fossil
* `$` or `%` for a simple user
* a red `#` for the root user
* if desired, the prompt will be replicated in your terminal window's
title (without the colors)
You can temporarily deactivate the liquid prompt and come back to your previous You can temporarily deactivate Liquid Prompt and revert to your previous prompt
one by typing `prompt_off`. Use `prompt_on` to bring it back. You can deactivate by typing `prompt_off`. Use `prompt_on` to bring it back. You can disable
any prompt and use a single mark sign (`$ ` for user and `# ` for root) with the *all* prompts and simply use a single mark sign (`$ ` for user and `# ` for root)
`prompt_OFF` command. by using the `prompt_OFF` command.
## TEST RIDE AND INSTALLATION ## Test Drive and Installation
Installation is simple. The basic dependencies are standard available on Unix. Installation is simple. The basic dependencies are standard Unix utilities/commands.
Please check if they are met if you experience some problems during the installation. If you experience some problems during the installation, please check that they
See the DEPENDENCIES section for what you need. are met; see the [dependencies](#dependencies) section for what you need specifically.
Follow these steps: Follow these steps:
``` cd
cd git clone https://github.com/nojhan/liquidprompt.git
git clone https://github.com/nojhan/liquidprompt.git source liquidprompt/liquidprompt
source liquidprompt/liquidprompt
```
To use it every time you start a shell add the following line to your To use it every time you start a shell, add the following lines to your
`.bashrc` (if you use bash) or `.zshrc` (if you use zsh): `.bashrc` (if you use Bash) or `.zshrc` (if you use zsh):
`source ~/liquidprompt/liquidprompt` # Only load Liquid Prompt in interactive shells, not from a script or from scp
[[ $- = *i* ]] && source ~/liquidprompt/liquidprompt
Next up is the configuration, you can skip this step if you already like the defaults: Next up is the configuration; you can skip this step if you like the defaults:
`cp ~/liquidprompt/liquidpromptrc-dist ~/.config/liquidpromptrc` cp ~/liquidprompt/liquidpromptrc-dist ~/.config/liquidpromptrc
You can also copy the file to `~/.liquidpromptrc`. You can also copy the file to `~/.liquidpromptrc`.
Use your favorite text editor to change the defaults. Use your favorite text editor to change the defaults.
The `liquidpromptrc` file is richly commented and easy to set your own defaults. The `liquidpromptrc` file is richly commented and easy to set your own defaults.
You can even theme liquidprompt and have a custom PS1. This is explained You can even theme Liquid Prompt and use a custom PS1 prompt. This is explained
in the sections below. in the sections below.
Check in your `.bashrc` that the `PROMPT_COMMAND` variable is not set, or else Check in your `.bashrc` that the `PROMPT_COMMAND` variable is not set, or else
the prompt will not be available. the prompt will not be available.
### INSTALLATION VIA ANTIGEN ### Installation via Antigen
To install via antigen, simply add the following line in your .zshrc after activating antigen: To install via antigen, simply add the following line in your `.zshrc` after activating antigen:
``` antigen bundle nojhan/liquidprompt
antigen bundle nojhan/liquidprompt
```
## DEPENDENCIES
## Dependencies
Apart from obvious ones, some features depend on specific commands. If you do Apart from obvious ones, some features depend on specific commands. If you do
not install them, the corresponding feature will not be available, but you will not install them, the corresponding feature will not be available, but no error
see no error. will be displayed.
* battery status needs `acpi` on GNU/Linux. * Battery status requires `acpi` on GNU/Linux.
* temperature status needs `acpi` or `lm-sensors` on GNU/Linux. * Temperature status requires `acpi` or `lm-sensors` on GNU/Linux.
* detached sessions is looking for `screen` and/or `tmux`. * Detached session status looks for `screen` and/or `tmux`.
* VCS support features needs… `git`, `hg`, `svn`, `bzr` or `fossil`, but you * VCS support features require `git`, `hg`, `svn`, `bzr` or `fossil`, but you
knew it. probably already knew that.
For other features, the script uses commands that should be available on a large For other features, the script uses commands that should be available on a large
variety of unixes: `tput`, `grep`, `awk`, `sed`, `ps`, `who`, `expr`. variety of Unix systems: `tput`, `grep`, `awk`, `sed`, `ps`, `who`, and `expr`.
## FEATURES CONFIGURATION ## Feature Configuration
You can configure some variables in the `~/.config/liquidpromptrc` file: You can configure some variables in the `~/.config/liquidpromptrc` file:
* `LP_BATTERY_THRESHOLD`, the maximal value under which the battery level is * `LP_BATTERY_THRESHOLD`, the maximal value under which the battery level is displayed
displayed
* `LP_LOAD_THRESHOLD`, the minimal value after which the load average is displayed * `LP_LOAD_THRESHOLD`, the minimal value after which the load average is displayed
* `LP_TEMP_THRESHOLD`, the minimal value after which the temperature average is * `LP_TEMP_THRESHOLD`, the minimal value after which the average temperature is displayed
displayed
* `LP_RUNTIME_THRESHOLD`, the minimal value after which the runtime is displayed * `LP_RUNTIME_THRESHOLD`, the minimal value after which the runtime is displayed
* `LP_PATH_LENGTH`, the maximum percentage of the screen width used to display * `LP_PATH_LENGTH`, the maximum percentage of the screen width used to display the path
the path * `LP_PATH_KEEP`, how many directories to keep at the beginning of a shortened path
* `LP_PATH_KEEP`, how many directories to keep at the beginning of a shortened * `LP_HOSTNAME_ALWAYS`, a choice between always displaying the hostname or
path showing it only when connected via a remote shell
* `LP_HOSTNAME_ALWAYS`, choose between always displaying the hostname or showing * `LP_USER_ALWAYS`, a choice between always displaying the user or showing
it only when connected with a remote shell it only when he is different from the one that logged in
* `LP_USER_ALWAYS`, choose between always displaying the user or showing
it only when he is different from the logged one
You can also force some features to be disabled, to save some time in the prompt You can also force some features to be disabled, to save some time in the
building: prompt-building process:
* `LP_ENABLE_PERM`, if you want to detect if the directory is writable
* `LP_ENABLE_PERM`, if you want to detect if the directory is writeable
* `LP_ENABLE_SHORTEN_PATH`, if you want to shorten the path display * `LP_ENABLE_SHORTEN_PATH`, if you want to shorten the path display
* `LP_ENABLE_PROXY`, if you want to detect if a proxy is used * `LP_ENABLE_PROXY`, if you want to detect if a proxy is used
* `LP_ENABLE_JOBS`, if you want to have jobs informations * `LP_ENABLE_JOBS`, if you want to have jobs information
* `LP_ENABLE_LOAD`, if you want to have load informations * `LP_ENABLE_LOAD`, if you want to have load information
* `LP_ENABLE_BATT`, if you want to have battery informations * `LP_ENABLE_BATT`, if you want to have battery information
* `LP_ENABLE_GIT`, if you want to have git informations * `LP_ENABLE_GIT`, if you want to have Git information
* `LP_ENABLE_SVN`, if you want to have subversion informations * `LP_ENABLE_SVN`, if you want to have Subversion information
* `LP_ENABLE_HG`, if you want to have mercurial informations * `LP_ENABLE_HG`, if you want to have Mercurial information
* `LP_ENABLE_BZR`, if you want to have bazaar informations * `LP_ENABLE_BZR`, if you want to have Bazaar information
* `LP_ENABLE_FOSSIL`, if you want to have fossil informations * `LP_ENABLE_FOSSIL`, if you want to have Fossil information
* `LP_ENABLE_VCS_ROOT`, if you want to show VCS informations with root account * `LP_ENABLE_VCS_ROOT`, if you want to show VCS informations with root account
* `LP_ENABLE_TITLE`, if you want to use the prompt as your terminal window's title * `LP_ENABLE_TITLE`, if you want to use the prompt as your terminal window's title
* `LP_ENABLE_SCREEN_TITLE`, if you want to use the prompt as your screen window's title * `LP_ENABLE_SCREEN_TITLE`, if you want to use the prompt as your screen window's title
* `LP_ENABLE_SSH_COLORS`, if you want different colors for hosts you SSH in * `LP_ENABLE_SSH_COLORS`, if you want different colors for hosts you SSH into
* `LP_ENABLE_RUNTIME`, if you want to display the runtime of the last command * `LP_ENABLE_RUNTIME`, if you want to display the runtime of the last command
* `LP_ENABLE_TIME`, if you want to display the time at which the prompt was shown * `LP_ENABLE_TIME`, if you want to display the time at which the prompt was shown
* `LP_ENABLE_OHMYGIT`, if you want to enable [Oh My Git](https://github.com/arialdomartini/oh-my-git) * `LP_ENABLE_OHMYGIT`, if you want to enable [Oh My Git](https://github.com/arialdomartini/oh-my-git)
* `LP_TIME_ANALOG`, when showing time, use an analog clock instead of numeric values * `LP_TIME_ANALOG`, if you want to show the time using an analog clock instead of numeric values
Note that if required commands are not installed, enabling the Note that if required commands are not installed, enabling the corresponding
corresponding feature will have no effect. feature will have no effect. Also, all the `LP_ENABLE_…` variables override the
Note also that all the `LP_ENABLE_…` variables override the templates, templates; i.e. if you use `$LP_BATT` in your template and you set `LP_ENABLE_BATT=0`
i.e. if you use `$LP_BATT` in your template and you set `LP_ENABLE_BATT=0` in your configuration file, your prompt will not have any battery information.
in your config file, you will not have the battery informations.
If you are using bash and want to use the `PROMPT_DIRTRIM` built-in If you are using Bash and want to use the `PROMPT_DIRTRIM` built-in
functionality to shorten but still have liquidprompt calculating the number of functionality to shorten but still want to have Liquid Prompt calculating the
directories to keep in the path, precise a value for `PROMPT_DIRTRIM` before number of directories to keep in the path, precise a value for `PROMPT_DIRTRIM`
sourcing liquidprompt and liquidprompt will override this value with one before sourcing Liquid Prompt and it will override this value with one fitting
fitting the width of your terminal. the width of your terminal.
You may face performances decrease when using VCS located in remote directories. You may face performances decrease when using VCS located in remote directories.
To avoid that, you can set the `LP_DISABLED_VCS_PATH` variable to a list of To avoid this, you can set the `LP_DISABLED_VCS_PATH` variable to a list of
absolute and colon (":") separated paths where VCS-related features will be absolute colon-separated paths where VCS-related features should be disabled.
disabled.
## CUSTOMIZING THE PROMPT ## Customizing the Prompt
### ADD A PREFIX/POSTFIX ### Adding a Prefix/Postfix
You can prefix the `LP_PS1` variable with anything you want using the You can prefix the `LP_PS1` variable with anything you want using
`LP_PS1_PREFIX`. The following example activate a custom window's title: `LP_PS1_PREFIX`. The following example activate a custom window's title:
LP_PS1_PREFIX="\[\e]0;\u@\h: \w\a\]" LP_PS1_PREFIX="\[\e]0;\u@\h: \w\a\]"
@ -207,21 +207,21 @@ newline and a single character:
LP_PS1_POSTFIX="\n>" LP_PS1_POSTFIX="\n>"
Note: the `prompt_tag` function is convenient way to add a prefix. You can thus add Note: the `prompt_tag` function is a convenient way to add a prefix. You can use
a keyword to your different terminals: it to add a keyword to each of your different terminals:
[:~/code/liquidprompt] develop ± prompt_tag mycode [:~/code/liquidprompt] develop ± prompt_tag mycode
mycode [:~/code/liquidprompt] develop ± mycode [:~/code/liquidprompt] develop ±
### PUT THE PROMPT IN A DIFFERENT ORDER ### Rearranging the Prompt
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
(`*.ps1`) in the configuration file. (`*.ps1`) in the configuration file.
You can start from the `liquid.ps1` file, which show the default settings. You can start from the `liquid.ps1` file, which show the default settings.
To use your own configuration, just set `LP_PS1_FILE` to your own file path in To use your own configuration, just set `LP_PS1_FILE` to your own file path in
your `~/.liquipromptrc` and you're done. your `~/.liquidpromptrc` and you're done.
Those scripts basically export the `LP_PS1` variable, by appending features and Those scripts basically export the `LP_PS1` variable, by appending features and
theme colors. theme colors.
@ -230,10 +230,10 @@ Available features:
* `LP_BATT` battery * `LP_BATT` battery
* `LP_LOAD` load * `LP_LOAD` load
* `LP_TEMP` temperature * `LP_TEMP` temperature
* `LP_JOBS` detached screen or tmux sessions/running jobs/suspended jobs * `LP_JOBS` detached `screen` or `tmux` sessions/running jobs/suspended jobs
* `LP_USER` user * `LP_USER` user
* `LP_HOST` hostname * `LP_HOST` hostname
* `LP_PERM` a colon ":" * `LP_PERM` a colon (`:`)
* `LP_PWD` current working directory * `LP_PWD` current working directory
* `LP_PROXY` HTTP proxy * `LP_PROXY` HTTP proxy
* `LP_VCS` informations concerning the current working repository * `LP_VCS` informations concerning the current working repository
@ -242,33 +242,33 @@ Available features:
* `LP_TITLE` the prompt as a window's title escaped sequences * `LP_TITLE` the prompt as a window's title escaped sequences
* `LP_BRACKET_OPEN` and `LP_BRACKET_CLOSE`, brackets enclosing the user+path part * `LP_BRACKET_OPEN` and `LP_BRACKET_CLOSE`, brackets enclosing the user+path part
For example, if you just want to have a liquidprompt displaying the user and the For example, if you just want to have a prompt displaying the user and the
host, with a normal full path in blue and only the git support: host, with a normal full path in blue and Git support only:
export LP_PS1=`echo -ne "[\${LP_USER}\${LP_HOST}:\${BLUE}\$(pwd)\${NO_COL}] \${LP_GIT} \\\$ "` export LP_PS1=`echo -ne "[\${LP_USER}\${LP_HOST}:\${BLUE}\$(pwd)\${NO_COL}] \${LP_GIT} \\\$ "`
Note that you need to properly escape dollars in a string that wil be Note that you need to properly escape dollar signs in a string that will be
interpreted by bash at each prompt. interpreted by Bash at each prompt.
To erase your new formatting, just bring the `LP_PS1` to a null string: To erase your new formatting, just bind `LP_PS1` to a null string:
export LP_PS1="" export LP_PS1=""
## Themes
## THEMES You can change the colors and special characters of some parts of Liquid Prompt
by sourcing your favorite theme file (`*.theme`) in the configuration file.
You can change the colors and special characters of some part of the liquid ### Colors
prompt by sourcing your favorite theme file (`*.theme`) in the configuration file.
### COLORS The available colours available for use are:
Available colors are: `BOLD`, `BLACK`, `BOLD_GRAY`, `WHITE`, `BOLD_WHITE`, `GREEN`, `BOLD_GREEN`,
BOLD, BLACK, BOLD_GRAY, WHITE, BOLD_WHITE, `YELLOW`, `BOLD_YELLOW`, `BLUE`, `BOLD_BLUE`, `PINK`, `CYAN`, `BOLD_CYAN,`,
GREEN, BOLD_GREEN, YELLOW, BOLD_YELLOW, BLUE, BOLD_BLUE, PINK, CYAN, BOLD_CYAN `RED`, `BOLD_RED`, `WARN_RED`, `CRIT_RED`, `DANGER_RED`, and `NO_COL`.
RED, BOLD_RED, WARN_RED, CRIT_RED, DANGER_RED,
NO_COL. Set the variable to a null string (`""`) if you do not want color.
Set to a null string "" if you do not want color.
* Current working directory * Current working directory
* `LP_COLOR_PATH` as normal user * `LP_COLOR_PATH` as normal user
@ -276,8 +276,8 @@ Set to a null string "" if you do not want color.
* Color of the proxy mark * Color of the proxy mark
* `LP_COLOR_PROXY` * `LP_COLOR_PROXY`
* Jobs count * Jobs count
* `LP_COLOR_JOB_D` Detached (screen/tmux sessions without attached clients) * `LP_COLOR_JOB_D` Detached (`screen` / `tmux` sessions without attached clients)
* `LP_COLOR_JOB_R` Running (xterm &) * `LP_COLOR_JOB_R` Running (`xterm &`)
* `LP_COLOR_JOB_Z` Sleeping (Ctrl-Z) * `LP_COLOR_JOB_Z` Sleeping (Ctrl-Z)
* `LP_COLOR_IN_MULTIPLEXER` currently running in a terminal multiplexer * `LP_COLOR_IN_MULTIPLEXER` currently running in a terminal multiplexer
* Last error code * Last error code
@ -293,16 +293,16 @@ Set to a null string "" if you do not want color.
* Hostname * Hostname
* `LP_COLOR_HOST` local host * `LP_COLOR_HOST` local host
* `LP_COLOR_SSH` connected via SSH * `LP_COLOR_SSH` connected via SSH
* `LP_COLOR_TELNET` connected via telnet * `LP_COLOR_TELNET` connected via `telnet`
* `LP_COLOR_X11_ON` connected with X11 support * `LP_COLOR_X11_ON` connected with X11 support
* `LP_COLOR_X11_OFF` connected without X11 support * `LP_COLOR_X11_OFF` connected without X11 support
* Separation mark (by default, the colon before the path) * Separation mark (by default, the colon before the path)
* `LP_COLOR_WRITE` have write permission * `LP_COLOR_WRITE` have write permission
* `LP_COLOR_NOWRITE` do not have write permission * `LP_COLOR_NOWRITE` do not have write permission
* VCS * VCS
* `LP_COLOR_UP` repository is up to date / a push have been made * `LP_COLOR_UP` repository is up-to-date / a push has been made
* `LP_COLOR_COMMITS` some commits have not been pushed * `LP_COLOR_COMMITS` some commits have not been pushed
* `LP_COLOR_CHANGES` there is some changes to commit * `LP_COLOR_CHANGES` there are some changes to commit
* `LP_COLOR_DIFF` number of lines or files impacted by current changes * `LP_COLOR_DIFF` number of lines or files impacted by current changes
* Battery * Battery
* `LP_COLOR_CHARGING_ABOVE` charging and above threshold * `LP_COLOR_CHARGING_ABOVE` charging and above threshold
@ -311,22 +311,23 @@ Set to a null string "" if you do not want color.
* `LP_COLOR_DISCHARGING_UNDER` discharging and under threshold * `LP_COLOR_DISCHARGING_UNDER` discharging and under threshold
### CHARACTERS ### Special Characters
Special characters: * `LP_MARK_DEFAULT` (default: "") the mark you want at the end of your prompt
* `LP_MARK_DEFAULT` (default: "") the mark you want at the end of your prompt (leave to empty for your shell default mark) (leave empty to use your shell's default mark)
* `LP_MARK_BATTERY` (default: "⌁") in front of the battery charge * `LP_MARK_BATTERY` (default: "⌁") in front of the battery charge
* `LP_MARK_ADAPTER` (default: "⏚") displayed when plugged * `LP_MARK_ADAPTER` (default: "⏚") displayed when plugged-in
* `LP_MARK_LOAD` (default: "⌂") in front of the load * `LP_MARK_LOAD` (default: "⌂") in front of the load
* `LP_MARK_PROXY` (default: "↥") indicate a proxy in use * `LP_MARK_PROXY` (default: "↥") indicate a proxy in use
* `LP_MARK_HG` (default: "☿") prompt mark in hg repositories * `LP_MARK_HG` (default: "☿") prompt mark in Mercurial repositories
* `LP_MARK_SVN` (default: "‡") prompt mark in svn repositories * `LP_MARK_SVN` (default: "‡") prompt mark in Subversion repositories
* `LP_MARK_GIT` (default: "±") prompt mark in git repositories * `LP_MARK_GIT` (default: "±") prompt mark in Git repositories
* `LP_MARK_FOSSIL` (default: "⌘") prompt mark in fossil repositories * `LP_MARK_FOSSIL` (default: "⌘") prompt mark in Fossil repositories
* `LP_MARK_BZR` (default: "⚯") prompt mark in bazaar repositories * `LP_MARK_BZR` (default: "⚯") prompt mark in Bazaar repositories
* `LP_MARK_DISABLED` (default: "⌀") prompt mark in disabled repositories (see `LP_DISABLED_VCS_PATH`) * `LP_MARK_DISABLED` (default: "⌀") prompt mark in disabled repositories
* `LP_MARK_UNTRACKED` (default: "\*") if git has untracked files (see `LP_DISABLED_VCS_PATH`)
* `LP_MARK_STASH` (default: "+") if git has stashed modifications * `LP_MARK_UNTRACKED` (default: "\*") if Git has untracked files
* `LP_MARK_STASH` (default: "+") if Git has stashed modifications
* `LP_MARK_BRACKET_OPEN` (default: "[") marks around the main part of the prompt * `LP_MARK_BRACKET_OPEN` (default: "[") marks around the main part of the prompt
* `LP_MARK_BRACKET_CLOSE` (default: "]") marks around the main part of the prompt * `LP_MARK_BRACKET_CLOSE` (default: "]") marks around the main part of the prompt
* `LP_TITLE_OPEN` (default: "\e]0;") escape character opening a window's title * `LP_TITLE_OPEN` (default: "\e]0;") escape character opening a window's title
@ -335,29 +336,29 @@ Special characters:
* `LP_SCREEN_TITLE_CLOSE` (default: "\033\134") escape character closing screen window's title * `LP_SCREEN_TITLE_CLOSE` (default: "\033\134") escape character closing screen window's title
## KNOWN LIMITATIONS AND BUGS ## Known Limitations and Bugs
Liquid prompt is distributed under the [GNU Affero General Public License Liquid Prompt is distributed under the [GNU Affero General Public License
version 3](LICENSE). version 3](LICENSE).
* Does not display the number of commits to be pushed in Mercurial repositories. * Does not display the number of commits to be pushed in Mercurial repositories.
* Browsing into very large subversion repositories may dramatically slow down * Browsing very large Subversion repositories may dramatically slow down
the display of the liquid prompt (use `LP_DISABLED_VCS_PATH` to avoid that). the display of Liquid Prompt (use `LP_DISABLED_VCS_PATH` to avoid that).
* Subversion repository cannot display commits to be pushed, this is a * Subversion repositories cannot display commits to be pushed; this is a
limitation of the Subversion versioning model. limitation of the Subversion versioning model.
* The proxy detection only uses the `$http_proxy` environment variable. * The proxy detection only uses the `$http_proxy` environment variable.
* The window's title escape sequence may not work properly on some terminals * The window's title escape sequence may not work properly on some terminals
(like xterm-256) (like `xterm-256`).
* The analog clock necessitate a Unicode-aware terminal and a at least one * The analog clock requires a Unicode-aware terminal and at least a
sufficiently complete font on your system. sufficiently complete font on your system. The [Symbola](http://users.teilar.gr/~g1951d/)
The [Symbola](http://users.teilar.gr/~g1951d/) font, designed by Georges Douros, font, designed by Georges Douros, is known to work well.
is known to work well. * Displaying the runtime currently only works with Bash.
* Displaying the runtime currently only works with bash
## AUTHORS
## Authors
Current Maintainer: [![endorse](https://api.coderwall.com/dolmen/endorsecount.png)](https://coderwall.com/dolmen) Current Maintainer: [![endorse](https://api.coderwall.com/dolmen/endorsecount.png)](https://coderwall.com/dolmen)
Original author: [![endorse](https://api.coderwall.com/nojhan/endorsecount.png)](https://coderwall.com/nojhan) Original Author: [![endorse](https://api.coderwall.com/nojhan/endorsecount.png)](https://coderwall.com/nojhan)
And many contributors! And many contributors!

View File

@ -1,23 +1,23 @@
# if you want to use the liquidprompt without bothering about its configuration, # If you want to use Liquid Prompt without bothering about its configuration,
# just: # just run the following command:
# cp example.bashrc ~/.bashrc # cp example.bashrc ~/.bashrc
# This part is a minimalist bash config file example # The following is a minimalistic Bash config file
# Use the system config if any # Use the system config if it exists
if [ -f /etc/bashrc ]; then if [ -f /etc/bashrc ]; then
. /etc/bashrc # --> Read /etc/bashrc, if present. . /etc/bashrc # --> Read /etc/bashrc, if present.
fi fi
# Use bash completion, if installed # Use Bash completion, if installed
if [ -f /etc/bash_completion ]; then if [ -f /etc/bash_completion ]; then
. /etc/bash_completion . /etc/bash_completion
fi fi
# If you have your own config for the liquid prompt, edit and uncomment this line: # If you have your own config for Liquid Prompt, edit and uncomment this line:
# source /path/to/liquidpromptrc # source /path/to/liquidpromptrc
# Use the liquidprompt # Use Liquid Prompt
source ~/.liquidprompt source ~/.liquidprompt

View File

@ -6,7 +6,7 @@
# Special characters # Special characters
# Be sure to use characters that exists in the font you use. You can use several # Be sure to use characters that exists in the font you use. You can use several
# characters at once. # characters at once.
# Below is an example of how to fallback to ascii if the term is not unicode capable. # Below is an example of how to fallback to ASCII if the term is not Unicode-capable.
# Defaults to UTF-8 characters. # Defaults to UTF-8 characters.
if [[ "$(locale -k LC_CTYPE | sed -n 's/^charmap="\(.*\)"/\1/p')" == *"UTF-8"* ]]; then if [[ "$(locale -k LC_CTYPE | sed -n 's/^charmap="\(.*\)"/\1/p')" == *"UTF-8"* ]]; then
# If charset is UTF-8. # If charset is UTF-8.

View File

@ -1,6 +1,6 @@
################################################################################ ################################################################################
# LIQUID PROMPT # LIQUID PROMPT
# An intelligent and non intrusive prompt for bash and zsh # An intelligent and non-intrusive prompt for Bash and zsh
################################################################################ ################################################################################
@ -181,7 +181,7 @@ unset LP_OLD_PWD
# to benefit of 'local' variables. # to benefit of 'local' variables.
# #
# What we do here: # What we do here:
# 1. Setup variables that can be used by the user: the "API" of liquidprompt # 1. Setup variables that can be used by the user: the "API" of Liquid Prompt
# for config/theme. Those variables are local to the function. # for config/theme. Those variables are local to the function.
# In practice, this is only color variables. # In practice, this is only color variables.
# 2. Setup default values # 2. Setup default values
@ -633,9 +633,9 @@ _lp_shorten_path()
fi fi
} }
# In bash shell, PROMPT_DIRTRIM is the number of directory to keep at the end # In Bash shells, PROMPT_DIRTRIM is the number of directory to keep at the end
# of the displayed path (if "\w" is present in the PS1 var). # of the displayed path (if "\w" is present in the PS1 var).
# liquidprompt can calculate this number under two condition, path shortening # Liquid Prompt can calculate this number under two conditions, path shortening
# must be disabled and PROMPT_DIRTRIM must be already set. # must be disabled and PROMPT_DIRTRIM must be already set.
_lp_set_dirtrim() { _lp_set_dirtrim() {
local p="$(_lp_get_home_tilde_collapsed)" local p="$(_lp_get_home_tilde_collapsed)"
@ -1323,7 +1323,7 @@ _lp_reset_runtime()
# reset the runtime counter # reset the runtime counter
[ "$_LP_RUNTIME_COMMAND_EXECUTED" != 1 ] && _LP_RUNTIME_LAST_SECONDS=$SECONDS && _LP_RUNTIME_SECONDS=0 [ "$_LP_RUNTIME_COMMAND_EXECUTED" != 1 ] && _LP_RUNTIME_LAST_SECONDS=$SECONDS && _LP_RUNTIME_SECONDS=0
# A proper command has been executed if the last command was not related to liquidprompt # A proper command has been executed if the last command was not related to Liquid Prompt
[ "$BASH_COMMAND" = _lp_set_prompt ] [ "$BASH_COMMAND" = _lp_set_prompt ]
_LP_RUNTIME_COMMAND_EXECUTED=$? _LP_RUNTIME_COMMAND_EXECUTED=$?
} }
@ -1748,10 +1748,10 @@ prompt_tag()
export LP_PS1_PREFIX="$(_lp_sr "$1")" export LP_PS1_PREFIX="$(_lp_sr "$1")"
} }
# Activate the liquid prompt # Activate Liquid Prompt
prompt_on() prompt_on()
{ {
# if liquidprompt has not been already set # if Liquid Prompt has not been already set
if [[ -z "$LP_OLD_PS1" ]] ; then if [[ -z "$LP_OLD_PS1" ]] ; then
LP_OLD_PS1="$PS1" LP_OLD_PS1="$PS1"
if $_LP_SHELL_bash; then if $_LP_SHELL_bash; then
@ -1769,7 +1769,7 @@ prompt_on()
# That doesn't seem to work: no time output # That doesn't seem to work: no time output
#if [[ "$LP_DEBUG_TIME" == 1 ]]; then #if [[ "$LP_DEBUG_TIME" == 1 ]]; then
# function precmd { # function precmd {
# local TIMEFMT='LiquidPrompt build time: %*E' # local TIMEFMT='Liquid Prompt build time: %*E'
# time _lp_set_prompt # time _lp_set_prompt
# } # }
#else #else
@ -1806,7 +1806,7 @@ prompt_OFF()
fi fi
} }
# By default, sourcing liquidprompt will activate the liquid prompt # By default, sourcing liquidprompt will activate Liquid Prompt
prompt_on prompt_on
# vim: set et sts=4 sw=4 tw=120 ft=bash syn=sh: # vim: set et sts=4 sw=4 tw=120 ft=bash syn=sh:

View File

@ -6,7 +6,7 @@
# If you want to use different themes and features, # If you want to use different themes and features,
# you can load the corresponding files here: # you can load the corresponding files here:
#source ~/.config/liquidprompt/nojhan.theme #source ~/.config/liquidprompt/nojhan.theme
#LP_PS1_FILE="~/.config/liquidprompt/nojhan.ps1" #LP_PS1_FILE=~/.config/liquidprompt/nojhan.ps1
############# #############
# BEHAVIOUR # # BEHAVIOUR #
@ -20,7 +20,7 @@ LP_BATTERY_THRESHOLD=75
# Recommended value is 60 # Recommended value is 60
LP_LOAD_THRESHOLD=60 LP_LOAD_THRESHOLD=60
# Minimal value after which the temperature is displayed (in celsius degrees) # Minimal value after which the temperature is displayed (in degrees Celsius)
# Recommended value is 60 # Recommended value is 60
LP_TEMP_THRESHOLD=60 LP_TEMP_THRESHOLD=60
@ -37,7 +37,7 @@ LP_PATH_KEEP=2
# set to 1 if you want to always see the hostname # set to 1 if you want to always see the hostname
LP_HOSTNAME_ALWAYS=0 LP_HOSTNAME_ALWAYS=0
# Do you want to display the user, even if he is the same than the logged one? # Do you want to display the user, even if the user is the same as the one logged in?
# Defaults to 1 (always display the user) # Defaults to 1 (always display the user)
# set to 0 if you want to hide the logged user (it will always display different users) # set to 0 if you want to hide the logged user (it will always display different users)
LP_USER_ALWAYS=1 LP_USER_ALWAYS=1
@ -47,51 +47,51 @@ LP_USER_ALWAYS=1
# Defaults to 1 (display percentages) # Defaults to 1 (display percentages)
LP_PERCENTS_ALWAYS=1 LP_PERCENTS_ALWAYS=1
# Do you want to use the permissions feature ? # Do you want to use the permissions feature?
# Recommended value is 1 # Recommended value is 1
LP_ENABLE_PERM=1 LP_ENABLE_PERM=1
# Do you want to use the shorten path feature ? # Do you want to use the shorten path feature?
# Recommended value is 1 # Recommended value is 1
LP_ENABLE_SHORTEN_PATH=1 LP_ENABLE_SHORTEN_PATH=1
# Do you want to use the proxy detection feature ? # Do you want to use the proxy detection feature?
# Recommended value is 1 # Recommended value is 1
LP_ENABLE_PROXY=1 LP_ENABLE_PROXY=1
# Do you want to use the jobs feature ? # Do you want to use the jobs feature?
# Recommended value is 1 # Recommended value is 1
LP_ENABLE_JOBS=1 LP_ENABLE_JOBS=1
# Do you want to use the load feature ? # Do you want to use the load feature?
# Recommended value is 1 # Recommended value is 1
LP_ENABLE_LOAD=1 LP_ENABLE_LOAD=1
# Do you want to use the batt feature ? # Do you want to use the battery feature?
# Recommended value is 1 # Recommended value is 1
LP_ENABLE_BATT=1 LP_ENABLE_BATT=1
# Do you want to use vcs features with root account # Do you want to use VCS features with the root account?
# Recommended value is 0 # Recommended value is 0
LP_ENABLE_VCS_ROOT=0 LP_ENABLE_VCS_ROOT=0
# Do you want to use the git special features ? # Do you want to use the Git special features?
# Recommended value is 1 # Recommended value is 1
LP_ENABLE_GIT=1 LP_ENABLE_GIT=1
# Do you want to use the svn special features ? # Do you want to use the Subversion special features?
# Recommended value is 1 # Recommended value is 1
LP_ENABLE_SVN=1 LP_ENABLE_SVN=1
# Do you want to use the mercurial special features ? # Do you want to use the Mercurial special features?
# Recommended value is 1 # Recommended value is 1
LP_ENABLE_HG=1 LP_ENABLE_HG=1
# Do you want to use the fossil special features ? # Do you want to use the Fossil special features?
# Recommended value is 1 # Recommended value is 1
LP_ENABLE_FOSSIL=1 LP_ENABLE_FOSSIL=1
# Do you want to use the bzr special features ? # Do you want to use the Bazaar special features?
# Recommanded value is 1 # Recommanded value is 1
LP_ENABLE_BZR=1 LP_ENABLE_BZR=1
@ -125,7 +125,7 @@ LP_ENABLE_TEMP=1
# Recommended value is 0 # Recommended value is 0
LP_TIME_ANALOG=0 LP_TIME_ANALOG=0
# Use the liquid prompt as the title of the terminal window # Use the prompt as the title of the terminal window
# The content is not customizable, the implementation is very basic, # The content is not customizable, the implementation is very basic,
# and this may not work properly on exotic terminals, thus the # and this may not work properly on exotic terminals, thus the
# recommended value is 0 # recommended value is 0