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