aboutsummaryrefslogtreecommitdiff
path: root/powerlevel9k.zsh-theme
diff options
context:
space:
mode:
authorRichard Tippl <richard.tippl@gmail.com>2017-08-08 20:44:20 +0300
committerRichard Tippl <richard.tippl@gmail.com>2017-08-10 18:14:13 +0300
commitb567ab22c2889726974dcfed543cc9ecb7e190cb (patch)
tree28958d2452250a3e4d3c9bacec0ff1321dbf285a /powerlevel9k.zsh-theme
parent93a1c4d2e86ea2c031165199d6d4dba1adf46468 (diff)
Implemented functionality from dir_writable to dir
When variable POWERLEVEL9K_DIR_SHOW_WRITABLE is set to true, dir prompt will have new state NOT_WRITABLE. This state will be set when user doesn't have permission to write in current working directory as in prompt dir_writable. When mode that allows icons is set, LOCK_ICON is used.
Diffstat (limited to 'powerlevel9k.zsh-theme')
-rwxr-xr-xpowerlevel9k.zsh-theme5
1 files changed, 4 insertions, 1 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme
index c2b53374..807495ec 100755
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -802,9 +802,12 @@ prompt_dir() {
"DEFAULT" "FOLDER_ICON"
"HOME" "HOME_ICON"
"HOME_SUBFOLDER" "HOME_SUB_ICON"
+ "NOT_WRITABLE" "LOCK_ICON"
)
local current_state="DEFAULT"
- if [[ $(print -P "%~") == '~' ]]; then
+ if [[ "${POWERLEVEL9K_DIR_SHOW_WRITABLE}" == "true" && ! -w "$PWD" ]]; then
+ current_state="NOT_WRITABLE"
+ elif [[ $(print -P "%~") == '~' ]]; then
current_state="HOME"
elif [[ $(print -P "%~") == '~'* ]]; then
current_state="HOME_SUBFOLDER"