Eric Torres 3bf21a54e6 Revert "Rename zsh plugins so they are detected by zsh"
This reverts commit 4890ff8aaa7b06e46888bcf67311a17d089c8123.
2020-06-21 22:53:45 -07:00

23 lines
412 B
Bash

# Fuzzy cd from anywhere
# Dependencies
# * fzf
# * mlocate
# ========== Shortcuts ==========
cf() {
[[ -z "${*}" ]] && return 1
[[ ! -x /usr/bin/fzf ]] && return 1
dir="$(locate --all --ignore-case --null -- "${@}" | fzf --read0 --select-1 --exit-0)"
[[ -z "${dir}" ]] && return 1
if [[ -f "${dir}" ]]; then
cd "${dir%/*}"
else
cd "${dir}"
fi
}
autoload -Uz cf