Skip to content

Instantly share code, notes, and snippets.

@andreasBihlmaier
Created June 10, 2015 20:44
Show Gist options
  • Save andreasBihlmaier/8e9590b5294c29137d8f to your computer and use it in GitHub Desktop.
Save andreasBihlmaier/8e9590b5294c29137d8f to your computer and use it in GitHub Desktop.
Cd_current completion zsh
#compdef Cd_current
List_current_dirs() {
ps ewwo command | \
fgrep -v COMMAND | \
awk '{ match($0,/PWD=[^ ][^ ]*/); { print substr($0, RSTART + 4, RLENGTH - 4) } }' | \
grep -v '\[^' | \
grep -v $HOME\$ | \
sort | \
uniq
}
_arguments "1:CurrentDirectories:($(List_current_dirs))"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment