Skip to content

Instantly share code, notes, and snippets.

@daniel-fanjul-alcuten
Last active October 1, 2015 18:28
Show Gist options
  • Save daniel-fanjul-alcuten/2037262 to your computer and use it in GitHub Desktop.
Save daniel-fanjul-alcuten/2037262 to your computer and use it in GitHub Desktop.
wcd setup
if [ -x /usr/bin/wcd.exec ]; then
function wcd() {
/usr/bin/wcd.exec -z 40 "$@"
. ~/bin/wcd.go
if [ "$STY" ]; then
screen -X title "$(basename "$PWD")"
fi
}
alias j='wcd -j'
alias g='wcd -g'
else
function wcd() {
for dir in ~/spotify/*; do
if dirname=$(basename "$dir") && grep "^$1" &>/dev/null <<<$dirname; then
cd "$dir" && {
if [ "$STY" ]; then
screen -X title "$dirname"
fi
echo "$PWD"
return 0
}
fi
done
return 1
}
alias j=wcd
alias g=wcd
fi
complete -o nospace -W "$(ls -1d ~/spotify/* | xargs -n 1 basename | tr "\\n" "\ ")" wcd
complete -o nospace -W "$(ls -1d ~/spotify/* | xargs -n 1 basename | tr "\\n" "\ ")" j
complete -o nospace -W "$(ls -1d ~/spotify/* | xargs -n 1 basename | tr "\\n" "\ ")" g
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment