Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I glue together ripgrep with fzf and bat like this:

    rg --line-number --no-heading --color=always --smart-case "$@" | fzf -d ':' -n 2.. --ansi --no-sort --preview-window 'down:20%:+{2}' --preview 'bat --style=numbers --color=always --highlight-line {2} {1}'
I get a small preview of the file in the bottom 20% of my terminal, and I can use fzf's matching to further filter, or to exclude things

I capture the output and then `cut` it up to get filename and line number, which then get used to open the file/line in vim



Thank you for this




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: