Skip to content

Instantly share code, notes, and snippets.

@ctaylo21
Created October 7, 2018 16:40
Show Gist options
  • Save ctaylo21/13694d28831e2aa6eb573f94201e4b80 to your computer and use it in GitHub Desktop.
Save ctaylo21/13694d28831e2aa6eb573f94201e4b80 to your computer and use it in GitHub Desktop.
Alias for using fzf to fuzzy-find files and then open the match with vim
# fo [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)
fo() {
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