diff options
author | Ben Hilburn <bhilburn@gmail.com> | 2017-08-12 20:17:55 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-12 20:17:55 +0300 |
commit | 6aca483b6046b7ec4a2ace6a0d1d3c2fd1022a36 (patch) | |
tree | 23b9a3c8518a6cb69f01c4802165848124842192 /powerlevel9k.zsh-theme | |
parent | 93a1c4d2e86ea2c031165199d6d4dba1adf46468 (diff) | |
parent | d784b1c8dce142fbf3f032c771252c2ffb563cec (diff) |
Merge pull request #592 from tippl/dir_write-588
Implemented functionality from dir_writable to dir
Diffstat (limited to 'powerlevel9k.zsh-theme')
-rwxr-xr-x | powerlevel9k.zsh-theme | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index c2b53374..8c78cb00 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -689,6 +689,7 @@ prompt_command_execution_time() { # Dir: current working directory set_default POWERLEVEL9K_DIR_PATH_SEPARATOR "/" set_default POWERLEVEL9K_HOME_FOLDER_ABBREVIATION "~" +set_default POWERLEVEL9K_DIR_SHOW_WRITABLE false prompt_dir() { local current_path="$(print -P "%~")" if [[ -n "$POWERLEVEL9K_SHORTEN_DIR_LENGTH" || "$POWERLEVEL9K_SHORTEN_STRATEGY" == "truncate_with_folder_marker" ]]; then @@ -802,9 +803,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" |