blob: e806da146e71a0f07779a487b70c216d51fd794a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
#!/bin/zsh
function frg {
result=$(rg --ignore-case --color=always --line-number --no-heading "$@" |
fzf --ansi \
--color 'hl:-1:underline,hl+:-1:underline:reverse' \
--delimiter ':' \
--preview "bat --color=always {1} --theme='gruvbox-dark' --highlight-line {2}" \
--preview-window 'up,60%,border-bottom,+{2}+3/3,~3')
file=${result%%:*}
linenumber=$(echo "${result}" | cut -d: -f2)
if [[ -n "$file" ]]; then
nvim +"${linenumber}" "$file"
fi
}
alias rgf=frg
|