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
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.