fzf
lets you set a --preview
command to display file previews when searching for a file with fzf
. Here we use bat
to preview files while using fzf
Ian Jones: [0:00] With fzf, you can search for any of your files, so menu start. With fzf --preview, you can give fzf a command to run to preview the file. I want to use bat. I have to pass this in. Now in fzf, when I look over a file, you can see that there's file previews, but you also notice that the colors are gone.
[0:33] We'll have to pass options to bat. This is where the --style comes in. We'll use numbers because we want line numbers and changes, as well as --color=always. Color is a flag. Now we can see we have color.
[1:01] The last thing we want to do is pipe the output of our bat command to head -500. This will prevent the terminal from rendering huge files.
Member comments are a way for members to communicate, interact, and ask questions about a lesson.
The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io
Be on-Topic
Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.
Avoid meta-discussion
Code Problems?
Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context
Details and Context
Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!