Review fzf aliases.
This commit is contained in:
parent
2dcf885212
commit
5955ac6b4b
18
zshrc
18
zshrc
|
@ -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"
|
||||||
|
|
Loading…
Reference in New Issue