Created
March 25, 2026 09:39
-
-
Save millancore/20d26e7befdc58c7386e2060c9a07383 to your computer and use it in GitHub Desktop.
Search, Jump & Edit with Nvim
This file contains hidden or 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
| #!/bin/bash | |
| vrg() { | |
| local result file line | |
| result=$( | |
| rg --line-number \ | |
| --glob '!vendor' \ | |
| --glob '!node_modules' \ | |
| "$1" | | |
| fzf --preview ' | |
| f=$(echo {} | cut -d: -f1) | |
| l=$(echo {} | cut -d: -f2) | |
| bat --color=always --highlight-line "$l" "$f" | |
| ' | |
| ) | |
| if [ -n "$result" ]; then | |
| file=$(echo "$result" | cut -d: -f1) | |
| line=$(echo "$result" | cut -d: -f2) | |
| nvim "+${line}" "${file}" | |
| fi | |
| } | |
| vrg "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment