skim icon indicating copy to clipboard operation
skim copied to clipboard

Skim needs a printf

Open EvanCarroll opened this issue 2 years ago • 0 comments

Brothers in Rust, it was brought to my attention that a new user of skim is executing a heathen program written in an inferior language because we lack a printf, observe

sk --ansi -mic "rg --color=always -n {} $1" --delimiter ':' --preview "bat {1} -H {2} -f --style=full"

In this execution we call out to rg --color=always -n {} $1 interactively. The output of that is in filename:linenumber:linecontents this gets broken up with the glorious argument --delimiter ':' which subsequently gets previewed with an execution of bat {1} -H {2} -f --style=full. Now when sk is given the command to select, there is no ability to the say you only want {1} or {2} or how you want the sk to output. What they're doing is this,

sk --ansi -mic "rg --color=always -n {} $1" --delimiter ':' --preview "bat {1} -H {2} -f --style=full" | awk -F ":" '{print $1}'

Which offends all of the Gods. It would be far more desirable to support this,

sk --ansi -mic "rg --color=always -n {} $1" --delimiter ':' --preview "bat {1} -H {2} -f --style=full" --printf "{1}"

We can even borrow the same logic in --preview, and just apply it to the output.

EvanCarroll avatar Sep 12 '23 23:09 EvanCarroll