Skip to content

Instantly share code, notes, and snippets.

@axelerator
Created May 26, 2020 16:51
Show Gist options
  • Save axelerator/06346d680b6037c97185a160a4bc7650 to your computer and use it in GitHub Desktop.
Save axelerator/06346d680b6037c97185a160a4bc7650 to your computer and use it in GitHub Desktop.
Open all files found with ripgrep in vim
#!/bin/sh
MATCHES=`rg -l $@ `
echo "$MATCHES"
read -p "Open these files?([Y/n])" -n 1 -r
if [[ $REPLY = '' || $REPLY =~ ^[Yy]$ ]]
then
FILES=`echo $MATCHES | tr "\n" ' '`
vim $FILES
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment