FollieHiyuki-dotfiles/home/.local/bin/fzf/fzrg

15 lines
309 B
Plaintext
Raw Normal View History

2021-02-13 11:28:59 -05:00
#!/bin/sh
choice=$(rg --color=always -n "$1" 2> /dev/null |
fzf -d: \
--ansi \
--query="$1" \
--disabled \
--no-multi \
--preview='bat --color=always --style=header,numbers -H {2} {1} | grep -C3 {q}')
line=$(echo "$choice" | cut -d':' -f2)
file=$(echo "$choice" | cut -d':' -f1)
nvim +"$line" "$PWD/$file"