Skip to content

Instantly share code, notes, and snippets.

@robhurring robhurring/examples.txt
Last active Feb 5, 2016

What would you like to do?
shortenpath for zsh/bash
/u/local: pwd b3bb610
~/P/proccli: pwd master da99d97 2↓ ✽
# vim-like shortenpath() function
# modified from
shortenpath() {
print -n "${1}" | sed -e "s|${HOME}|~|" -e 's:\(/*\)\([^\.]\)[^/]*/:\1\2/:g'
shortenpath "$(pwd)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.