Skip to content

Instantly share code, notes, and snippets.

@keith
Created February 17, 2014 02:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keith/9043754 to your computer and use it in GitHub Desktop.
Save keith/9043754 to your computer and use it in GitHub Desktop.
Mimicking %2c from zsh
set __pwd (pwd)
set __parent (basename (dirname $__pwd))
set __current (basename $__pwd)
set __full (printf "%s/%s" $__parent $__current)
set __home (echo $HOME | awk '{ print substr($1, 2, length($1) - 1); }')
set __prompt (echo "$__full" | sed -e "s|$__home|~|" -e "s|$USER|~|" -e "s|^///|/|" -e "s|^//|/|")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment