diff --git a/README.md b/README.md index 5e4481c..a56a93d 100644 --- a/README.md +++ b/README.md @@ -130,6 +130,13 @@ Note also that all the `LP_ENABLE_…` variables override the templates, i.e. if you use `$LP_BATT` in your template and you set `LP_ENABLE_BATT=0` 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 +functionality to shorten but still have liquidprompt calculating the number of +directories to keep in the path, precise a value for `PROMPT_DIRTRIM` before +sourcing liquidprompt and liquidprompt will override this value with one +fitting the width of your terminal. + + ## CUSTOMIZING THE PROMPT ### ADD A PS1 PREFIX diff --git a/liquidprompt b/liquidprompt index c328ff0..ce61fba 100755 --- a/liquidprompt +++ b/liquidprompt @@ -490,7 +490,10 @@ _lp_shorten_path() fi } - +# In bash shell, PROMPT_DIRTRIM is the number of directory to keep at the end +# of the displayed path (if "\w" is present in the PS1 var). +# liquidprompt can calculate this number under two condition, path shortening +# must be activated and PROMPT_DIRTRIM must be already set. _lp_get_dirtrim() { [[ "$LP_ENABLE_SHORTEN_PATH" != 1 ]] && echo 0 && return