Review fzf aliases.

This commit is contained in:
Jeremy Gardais 2017-12-15 10:47:39 +01:00
parent 2dcf885212
commit 5955ac6b4b
1 changed files with 9 additions and 9 deletions

18
zshrc
View File

@ -706,24 +706,24 @@ function translate()
## fzf
# fd - cd to selected directory (exclude hidden directories
fd() {
# ff - cd to selected directory (exclude hidden directories
ff() {
local dir
dir=$(find ${1:-.} -path '*/\.*' -prune \
-o -type d -print 2> /dev/null | fzf +m) &&
cd "$dir"
}
# fdh - hidden directories only
fdh() {
# ffh - hidden directories only
ffh() {
local dir
dir=$(find ${1:-.} -type d 2> /dev/null | fzf +m) && cd "$dir"
}
# fda - all directories
# ffa - all directories
# fdr - cd to selected parent directory
fdr() {
# ffr - cd to selected parent directory
ffr() {
local declare dirs=()
get_parent_dirs() {
if [[ -d "${1}" ]]; then dirs+=("$1"); else return; fi
@ -737,8 +737,8 @@ fdr() {
cd "$DIR"
}
# fdf - cd into the directory of the selected file
fdf() {
# fff - cd into the directory of the selected file
fff() {
local file
local dir
file=$(fzf +m -q "$1") && dir=$(dirname "$file") && cd "$dir"