doronbehar / pistol

General purpose file previewer designed for Ranger, Lf to make scope.sh redundant
MIT License
322 stars 7 forks source link

Doesn't show content of file but return `JavaScript source, Unicode text, UTF-8 text` #106

Closed ogios closed 6 months ago

ogios commented 6 months ago

image

but there is content in that file, i don't know why it happens to some specific file

doronbehar commented 6 months ago

Could you attach please an example file, or a link to such a file?

ogios commented 6 months ago

@doronbehar ok, https://gist.github.com/ogios/0b11c7652b7d5013ed67d576e2b04f13#file-tailwind-config-ts

doronbehar commented 6 months ago

Yes so this is kind of by design like that. If you'd run file --mime-type on that file, you'd get:

javascript/application

Which doesn't has the text/ prefix. I'm not sure this default behavior should change, but that is open for discussion. You can use this line in your ~/.config/pistol/pistol.conf:

application/javascript bat --style=plain --paging=never --color=always %pistol-filename%

Where bat this project. The same goes for application/json files, as discussed in #34 .

Another improvement could be modifying the README to explain this behavior.

ogios commented 6 months ago

thanks, i understand it now. and set cmd for specific type works

doronbehar commented 6 months ago

Hey @ogios after having a 2nd thought on the subject, and reading this Q&A I decided to also make pistol read application/javascript files as if they were text files by default. You should be able to remove then the application/javascript line from your pistol.conf if you install the latest revision of pistol.