Skip to content

Instantly share code, notes, and snippets.

@wkf
Created March 26, 2014 14:09
Show Gist options
  • Save wkf/9783999 to your computer and use it in GitHub Desktop.
Save wkf/9783999 to your computer and use it in GitHub Desktop.
function prompt_dir -d "Display the actual directory"
set -l root_path
set -l root_name
if command git rev-parse --is-inside-work-tree >/dev/null 2>&1
set root_path (command git rev-parse --show-toplevel 2> /dev/null)
set root_name (basename $root_path)
set root_path (echo $root_path | sed -e 's/\//\\\\\//g')
prompt_segment normal "#404040" (echo $root_name(pwd | sed -e "s/$root_path//g"))
else
prompt_segment normal "#404040" (prompt_pwd)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment