Skip to content

Commit

Permalink
Merge branch '430-LP_MARK_PERM' (#430)
Browse files Browse the repository at this point in the history
  • Loading branch information
dolmen committed Nov 28, 2016
2 parents b7da45f + c4910ee commit 5ee3c53
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
5 changes: 4 additions & 1 deletion CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@ NEXT
New features:
- Workaround broken .bashrc that export PROMPT_COMMAND (GH #450, #463):
we now unexport it on startup
- Allow to customize the symbol before the path that shows if the
directory is writable: LP_MARK_PERM (GitHub #430, #484)
Bug fixes:
- Fix regression in LP_ENABLE_FQDN implementation (GitHub #472)
- Fix LP_COLOR_HOST_HASH on SunOS (GitHub #461, #462)
Thanks to Roman (@hatifnatt), Jon Garrison (@jpwgarrison),
Mark Vander Stel (@Rycieos), Bryce Jasmer (b-jazz), Felix
Schlitter (@felixSchl)...
Schlitter (@felixSchl), Philip Garrison (@pgarrison), Lubomir
Host (@lhost)...
... for their patches or bug reports.

1.11 2016-06-25
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,8 @@ Set the variable to a null string (`""`) if you do not want color.
* `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_CLOSE` (default: "]") marks around the main part of the prompt
* `LP_MARK_PERM` (default: ":") colored green red or green to indicate write
permissions of the current directory
* `LP_TITLE_OPEN` (default: "\e]0;") escape character opening a window's title
* `LP_TITLE_CLOSE` (default: "\a") escape character closing a window's title

Expand Down
2 changes: 2 additions & 0 deletions liquid.theme
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ if [[ "$(locale -k LC_CTYPE | sed -n 's/^charmap="\(.*\)"/\1/p')" == *"UTF-8"* ]
LP_MARK_UNTRACKED="*" # if git has untracked files
LP_MARK_STASH="+" # if git has stashs
LP_MARK_SHORTEN_PATH="" # prompt mark in shortened paths
LP_MARK_PERM=":" # separator between host and path
else
# If charset is anything else, fallback to ASCII chars
LP_MARK_BATTERY="b"
Expand All @@ -38,6 +39,7 @@ else
LP_MARK_UNTRACKED="*"
LP_MARK_STASH="+"
LP_MARK_SHORTEN_PATH=" ... "
LP_MARK_PERM=":"
fi

LP_MARK_BRACKET_OPEN="[" # open bracket
Expand Down
8 changes: 5 additions & 3 deletions liquidprompt
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ _lp_source_config()
LP_MARK_BRACKET_CLOSE="${LP_MARK_BRACKET_CLOSE:-"]"}"
LP_MARK_SHORTEN_PATH="${LP_MARK_SHORTEN_PATH:-""}"
LP_MARK_PREFIX="${LP_MARK_PREFIX:-" "}"
LP_MARK_PERM="${LP_MARK_PERM:-":"}"

LP_COLOR_PATH=${LP_COLOR_PATH:-$BOLD}
LP_COLOR_PATH_ROOT=${LP_COLOR_PATH_ROOT:-$BOLD_YELLOW}
Expand Down Expand Up @@ -523,7 +524,7 @@ else
fi

# Default value for LP_PERM when LP_ENABLE_PERM is 0
LP_PERM=: # without color
LP_PERM=${LP_MARK_PERM} # without color

# Same as bash '\l', but inlined as a constant as the value will not change
# during the shell's life
Expand Down Expand Up @@ -1759,11 +1760,12 @@ _lp_set_prompt()
# LP_PERM: shows a ":"
# - colored in green if user has write permission on the current dir
# - colored in red if not
# - can set another symbol with LP_MARK_PERM
if (( LP_ENABLE_PERM )); then
if [[ -w "${PWD}" ]]; then
LP_PERM="${LP_COLOR_WRITE}:${NO_COL}"
LP_PERM="${LP_COLOR_WRITE}${LP_MARK_PERM}${NO_COL}"
else
LP_PERM="${LP_COLOR_NOWRITE}:${NO_COL}"
LP_PERM="${LP_COLOR_NOWRITE}${LP_MARK_PERM}${NO_COL}"
fi
fi

Expand Down

0 comments on commit 5ee3c53

Please sign in to comment.