[{"data":1,"prerenderedAt":140},["ShallowReactive",2],{"blog-post-bat-fzf-preview":3,"recent-posts":79},{"id":4,"uid":5,"url":6,"type":7,"href":8,"tags":9,"first_publication_date":10,"last_publication_date":10,"slugs":11,"linked_documents":13,"lang":14,"alternate_languages":15,"data":16},"awGsABIAAC4AFqOV","bat-fzf-preview",null,"blog_posts","https:\u002F\u002Fmarks-personal-website.cdn.prismic.io\u002Fapi\u002Fv2\u002Fdocuments\u002Fsearch?ref=awoIKhMAACcAzECF&q=%5B%5B%3Ad+%3D+at%28document.id%2C+%22awGsABIAAC4AFqOV%22%29+%5D%5D",[],"2026-11-27T22:46:01+0000",[12],"bat-how-to-use-it-with-the-fzf-preview",[],"en-us",[],{"title":17,"date":23,"description":24,"image":29,"content":39},[18],{"type":19,"text":20,"spans":21,"direction":22},"heading1","Bat: How to Use It with the fzf Preview",[],"ltr","2026-11-27",[25],{"type":26,"text":27,"spans":28,"direction":22},"heading2","Learn how to use bat as the file preview in fzf, with syntax highlighting",[],{"dimensions":30,"alt":20,"copyright":6,"url":33,"id":34,"edit":35},{"width":31,"height":32},1280,720,"https:\u002F\u002Fimages.prismic.io\u002Fmarks-personal-website\u002FyluC4Cg8MouHKxRa_bat-fzf-preview.png?auto=format,compress","yluC4Cg8MouHKxRa",{"x":36,"y":36,"zoom":37,"background":38},0,1,"transparent",[40,44,48,51,54,57,60,63,66,69,73,76],{"type":41,"text":42,"spans":43,"direction":22},"paragraph","Before we start, make sure you have \u003Ccode>bat\u003C\u002Fcode> and \u003Ccode>fzf\u003C\u002Fcode> installed on your computer and some files ready in a folder. If you don't have them yet, you can install both with Homebrew:",[],{"type":45,"text":46,"spans":47,"direction":22},"preformatted","brew install bat fzf",[],{"type":41,"text":49,"spans":50,"direction":22},"First, open your terminal and navigate to the folder with your files. To add a bat preview to fzf, run this command:",[],{"type":45,"text":52,"spans":53,"direction":22},"fzf --preview 'bat --color=always {}'",[],{"type":41,"text":55,"spans":56,"direction":22},"The \u003Ccode>--preview\u003C\u002Fcode> flag runs a command for whichever file is highlighted, and \u003Ccode>{}\u003C\u002Fcode> gets replaced with that file name. The \u003Ccode>--color=always\u003C\u002Fcode> flag matters, because bat turns its colors off when it runs inside another program, so without it your preview would be plain text.",[],{"type":41,"text":58,"spans":59,"direction":22},"You should now see your list of files on the left and a live preview on the right. Type a few letters to filter the list, and the preview follows along.",[],{"type":41,"text":61,"spans":62,"direction":22},"For a cleaner preview that stays fast on big files, use this version:",[],{"type":45,"text":64,"spans":65,"direction":22},"fzf --preview 'bat --color=always --style=numbers --line-range :500 {}' --preview-window 'right:60%'",[],{"type":41,"text":67,"spans":68,"direction":22},"The \u003Ccode>--style=numbers\u003C\u002Fcode> flag drops bat's header and borders, \u003Ccode>--line-range :500\u003C\u002Fcode> only loads the first 500 lines, and \u003Ccode>--preview-window 'right:60%'\u003C\u002Fcode> gives the preview 60% of the width.",[],{"type":70,"oembed":71},"embed",{"embed_url":72,"type":70},"",{"type":41,"text":74,"spans":75,"direction":22},"To get the same preview when you press \u003Ccode>control + T\u003C\u002Fcode> in your terminal, add this line to your \u003Ccode>~\u002F.zshrc\u003C\u002Fcode> file. It only works if fzf's shell integration is loaded, which is \u003Ccode>source \u003C(fzf --zsh)\u003C\u002Fcode>:",[],{"type":45,"text":77,"spans":78,"direction":22},"export FZF_CTRL_T_OPTS=\"--preview 'bat --color=always --style=numbers --line-range :500 {}'\"",[],{"results":80,"page":37,"results_per_page":138,"results_size":138,"total_results_size":139,"total_pages":37},[81,100,119],{"id":82,"uid":83,"url":6,"type":7,"href":84,"tags":85,"first_publication_date":10,"last_publication_date":10,"slugs":86,"linked_documents":88,"lang":14,"alternate_languages":89,"data":90},"awGsBRIAAC0AFqOw","httpie-pretty-print-json","https:\u002F\u002Fmarks-personal-website.cdn.prismic.io\u002Fapi\u002Fv2\u002Fdocuments\u002Fsearch?ref=awoIKhMAACcAzECF&q=%5B%5B%3Ad+%3D+at%28document.id%2C+%22awGsBRIAAC0AFqOw%22%29+%5D%5D",[],[87],"httpie-how-to-pretty-print-json",[],[],{"image":91,"title":97},{"dimensions":92,"alt":93,"copyright":6,"url":94,"id":95,"edit":96},{"width":31,"height":32},"HTTPie: How to Pretty Print JSON","https:\u002F\u002Fimages.prismic.io\u002Fmarks-personal-website\u002FlCNUDBWv_1DmEc9s_httpie-pretty-print-json.png?auto=format,compress","lCNUDBWv_1DmEc9s",{"x":36,"y":36,"zoom":37,"background":38},[98],{"type":19,"text":93,"spans":99,"direction":22},[],{"id":101,"uid":102,"url":6,"type":7,"href":103,"tags":104,"first_publication_date":10,"last_publication_date":10,"slugs":105,"linked_documents":107,"lang":14,"alternate_languages":108,"data":109},"awGsAhIAACkAFqOe","bat-git-diff","https:\u002F\u002Fmarks-personal-website.cdn.prismic.io\u002Fapi\u002Fv2\u002Fdocuments\u002Fsearch?ref=awoIKhMAACcAzECF&q=%5B%5B%3Ad+%3D+at%28document.id%2C+%22awGsAhIAACkAFqOe%22%29+%5D%5D",[],[106],"bat-how-to-use-it-with-git-diff",[],[],{"image":110,"title":116},{"dimensions":111,"alt":112,"copyright":6,"url":113,"id":114,"edit":115},{"width":31,"height":32},"Bat: How to Use It with git diff","https:\u002F\u002Fimages.prismic.io\u002Fmarks-personal-website\u002Fhv5njvdg6CY6UfYl_bat-git-diff.png?auto=format,compress","hv5njvdg6CY6UfYl",{"x":36,"y":36,"zoom":37,"background":38},[117],{"type":19,"text":112,"spans":118,"direction":22},[],{"id":120,"uid":121,"url":6,"type":7,"href":122,"tags":123,"first_publication_date":10,"last_publication_date":10,"slugs":124,"linked_documents":126,"lang":14,"alternate_languages":127,"data":128},"awGsBBIAACsAFqOq","bat-hide-file-header","https:\u002F\u002Fmarks-personal-website.cdn.prismic.io\u002Fapi\u002Fv2\u002Fdocuments\u002Fsearch?ref=awoIKhMAACcAzECF&q=%5B%5B%3Ad+%3D+at%28document.id%2C+%22awGsBBIAACsAFqOq%22%29+%5D%5D",[],[125],"bat-how-to-hide-the-file-header",[],[],{"image":129,"title":135},{"dimensions":130,"alt":131,"copyright":6,"url":132,"id":133,"edit":134},{"width":31,"height":32},"Bat: How to Hide the File Header","https:\u002F\u002Fimages.prismic.io\u002Fmarks-personal-website\u002F7ZkXhTyVPYMIyYzS_bat-hide-file-header.png?auto=format,compress","7ZkXhTyVPYMIyYzS",{"x":36,"y":36,"zoom":37,"background":38},[136],{"type":19,"text":131,"spans":137,"direction":22},[],3,104,1795819585984]