Created
October 6, 2019 21:25
-
-
Save omkar0001/9ba841b207be95137dbbae568c14f7b2 to your computer and use it in GitHub Desktop.
FZF utils
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env zsh | |
# fd - cd to selected directory | |
fd() { | |
local dir | |
dir=$(find ${1:-.} -path '*/\.*' -prune \ | |
-o -type d -print 2> /dev/null | fzf +m) && | |
cd "$dir" | |
} | |
# fe [FUZZY PATTERN] - Open the selected file with the default editor | |
# - Bypass fuzzy finder if there's only one match (--select-1) | |
# - Exit if there's no match (--exit-0) | |
fe() { | |
local files | |
IFS=$'\n' files=($(fzf-tmux --query="$1" --multi --select-1 --exit-0)) | |
[[ -n "$files" ]] && ${EDITOR:-vim} "${files[@]}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment