Skip to content

Instantly share code, notes, and snippets.

@hacolab
Created July 20, 2019 06:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hacolab/de5828c1b0904be2e9c9bd122ce95c27 to your computer and use it in GitHub Desktop.
Save hacolab/de5828c1b0904be2e9c9bd122ce95c27 to your computer and use it in GitHub Desktop.
#!/bin/sh
query=$1
if [ $# -eq 2 ]; then
[ -d "$1" ] && cd "$1" \
|| ( echo "'$1' is not directory!" && exit 1 )
query=$2
fi
selected_files=`fzf --query="$query" --multi --select-1 --preview "head -n 100 {}"`
[ -n "$selected_files" ] && nvim `echo "$selected_files" | tr '\n' ' '`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment