From b379f03f148d99a0da8c8eb200f17b3007a87e47 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Mon, 30 Jan 2017 21:10:09 +0100 Subject: [PATCH] Add ability to omit the first character in dir path --- README.md | 7 +++++-- powerlevel9k.zsh-theme | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f7a80a09..04632323 100644 --- a/README.md +++ b/README.md @@ -304,9 +304,12 @@ the path shown would be `my-cool-project`. If you navigate to `$HOME/projects/m If you want to customize the directory separator, you could set: ```zsh -# You'll need patched awesome-terminal fonts for that example -POWERLEVEL9K_DIR_PATH_SEPARATOR="%f "$'\uE0B1'" %F" +# Double quotes are important here! +POWERLEVEL9K_DIR_PATH_SEPARATOR="%F{red} $(print_icon 'LEFT_SUBSEGMENT_SEPARATOR') %F{black}" ``` +To omit the first character (usually a slash that gets replaced if you set `POWERLEVEL9K_DIR_PATH_SEPARATOR`), +you could set `POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER=true`. + ##### disk_usage diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index f104b789..3010790e 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -616,6 +616,10 @@ prompt_dir() { esac fi + if [[ "${POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER}" == "true" ]]; then + current_path="${current_path[2,-1]}" + fi + if [[ "${POWERLEVEL9K_DIR_PATH_SEPARATOR}" != "/" ]]; then current_path=$(print -P "${current_path}" | sed "s/\//${POWERLEVEL9K_DIR_PATH_SEPARATOR}/g") fi