From 673279173d1ce9dcf4ce508b0fe8ff325d1b745d Mon Sep 17 00:00:00 2001 From: Thomas Forgione Date: Thu, 10 Aug 2017 10:45:44 +0000 Subject: [PATCH] Truncated pwd --- zsh/oh-my-zsh/themes/laptop.zsh-theme | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/zsh/oh-my-zsh/themes/laptop.zsh-theme b/zsh/oh-my-zsh/themes/laptop.zsh-theme index 6b3fef8..d9dd8a7 100644 --- a/zsh/oh-my-zsh/themes/laptop.zsh-theme +++ b/zsh/oh-my-zsh/themes/laptop.zsh-theme @@ -45,9 +45,18 @@ else fi # local return_code="%(?..%{$PR_RED%}%? ↵%{$PR_NO_COLOR%})" +truncated_pwd() { + current_pwd=$(print -rD $PWD) + if [ ${#current_pwd} -gt 50 ]; then + last_dirs=`echo ${current_pwd: -50} | cut -d '/' -f 2-` + echo "~/.../${last_dirs}" + else + echo $current_pwd + fi +} local user_host='$PR_BOLD${PR_USER}$PR_BOLD' -local current_dir='$PR_BOLD%{$PR_BLUE%}%~%{$PR_NO_COLOR%}' +local current_dir='$PR_BOLD%{$PR_BLUE%}$(truncated_pwd)$PR_NO_COLOR%}' local rvm_ruby='' if which rvm-prompt &> /dev/null; then rvm_ruby='%{$PR_RED%}‹$(rvm-prompt i v g s)›%{$PR_NO_COLOR%}'