2

I have a alias which when you pass a parameter will look like this

rg --trim --no-heading test_based_image $HOME/ -n | fzf --color='preview-fg:110' --preview="cut -d":" -f1 <<< {} | xargs bat "

The first part will return something like

/home/iob/path/some_file.pm:46:test_based_image

The preview will display the source code of some_file.pm.

My problem is i want to replace the bat command with bat -R to highlight the line 46. i try to do the following

rg --trim --no-heading test_based_image $HOME/ -n | fzf --color='preview-fg:110' --preview="cut -d":" -f1 <<< {} | xargs bat -r $(cut -d":" -f2 <<< {}) "

but this fails showing this in the preview

[bat error]: line range contained more than one ':' character. Expected format 'N' or 'N:M'

Any ideas how can overcome this? i cant get where the complains come from as the bat does its thing when i run it alone.

b10n1k
  • 567
  • 5
  • 21
  • I think what you are trying to do is something like this: `rg --vimgrep . | fzf --delimiter : --preview 'bat --color=always --highlight-line {2} {1}` – Peter Benjamin Jul 27 '21 at 06:57

0 Answers0