{"id":156,"date":"2023-11-27T10:51:25","date_gmt":"2023-11-27T01:51:25","guid":{"rendered":"https:\/\/www.aisoit.com\/?p=156"},"modified":"2024-02-13T19:00:48","modified_gmt":"2024-02-13T10:00:48","slug":"use-bat-replace-cat","status":"publish","type":"post","link":"https:\/\/www.aisoit.com\/?p=156","title":{"rendered":"Use &#8220;bat&#8221; replace &#8220;cat&#8221;, Syntax highlighting"},"content":{"rendered":"\n<p>ref: https:\/\/github.com\/sharkdp\/bat<\/p>\n\n\n\n<div class=\"wp-block-jetpack-markdown\"><h2>1.1 show file colorfull like vscode.<\/h2>\n<p>bat array.c<\/p>\n<\/div>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"632\" height=\"455\" src=\"https:\/\/www.aisoit.com\/wp-content\/uploads\/2023\/11\/image-1.png\" alt=\"\" class=\"wp-image-157\" srcset=\"https:\/\/www.aisoit.com\/wp-content\/uploads\/2023\/11\/image-1.png 632w, https:\/\/www.aisoit.com\/wp-content\/uploads\/2023\/11\/image-1-300x216.png 300w\" sizes=\"auto, (max-width: 632px) 100vw, 632px\" \/><\/figure><\/div>\n\n\n<div class=\"wp-block-jetpack-markdown\"><h2>1.2 install bat<\/h2>\n<\/div>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#d8dee9ff;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"# install bat to mac osx with brew\nbrew install bat\n# install bat to ubuntu\nwget https:\/\/github.com\/sharkdp\/bat\/releases\/download\/v0.24.0\/bat_0.24.0_amd64.deb\nsudo dpkg -i bat_0.24.0_amd64.deb\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #616E88\"># install bat to mac osx with brew<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">brew<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">install<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">bat<\/span><\/span>\n<span class=\"line\"><span style=\"color: #616E88\"># install bat to ubuntu<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">wget<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">https:\/\/github.com\/sharkdp\/bat\/releases\/download\/v0.24.0\/bat_0.24.0_amd64.deb<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">sudo<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">dpkg<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">-i<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">bat_0.24.0_amd64.deb<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<div class=\"wp-block-jetpack-markdown\"><h2>1.3 config bat as cat<\/h2>\n<\/div>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#d8dee9ff;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"alias cat='bat --paging=never'\necho &quot;alias cat='bat --paging=never'&quot; &gt;&gt; ~\/.bashrc\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #81A1C1\">alias<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">cat<\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #A3BE8C\">bat --paging=never<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">echo<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">alias cat=&#39;bat --paging=never&#39;<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">&gt;&gt;<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">~\/.bashrc<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p><\/p>\n<div class=\"likebtn_container\" style=\"\"><!-- LikeBtn.com BEGIN --><span class=\"likebtn-wrapper\"  data-identifier=\"post_156\"  data-site_id=\"65cb32bb943ec9f6275ac6aa\"  data-style=\"\"  data-unlike_allowed=\"\"  data-show_copyright=\"\"  data-item_url=\"https:\/\/www.aisoit.com\/?p=156\"  data-item_title=\"Use &quot;bat&quot; replace &quot;cat&quot;, Syntax highlighting\"  data-item_date=\"2023-11-27T10:51:25+09:00\"  data-engine=\"WordPress\"  data-plugin_v=\"2.6.58\"  data-prx=\"https:\/\/www.aisoit.com\/wp-admin\/admin-ajax.php?action=likebtn_prx\"  data-event_handler=\"likebtn_eh\" ><\/span><!-- LikeBtn.com END --><\/div>","protected":false},"excerpt":{"rendered":"<p>ref: https:\/\/github.com\/sharkdp\/bat<\/p>\n<div class=\"likebtn_container\" style=\"\"><!-- LikeBtn.com BEGIN --><span class=\"likebtn-wrapper\"  data-identifier=\"post_156\"  data-site_id=\"65cb32bb943ec9f6275ac6aa\"  data-style=\"\"  data-unlike_allowed=\"\"  data-show_copyright=\"\"  data-item_url=\"https:\/\/www.aisoit.com\/?p=156\"  data-item_title=\"Use &quot;bat&quot; replace &quot;cat&quot;, Syntax highlighting\"  data-item_date=\"2023-11-27T10:51:25+09:00\"  data-engine=\"WordPress\"  data-plugin_v=\"2.6.58\"  data-prx=\"https:\/\/www.aisoit.com\/wp-admin\/admin-ajax.php?action=likebtn_prx\"  data-event_handler=\"likebtn_eh\" ><\/span><!-- LikeBtn.com END --><\/div>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[9],"tags":[],"class_list":["post-156","post","type-post","status-publish","format-standard","hentry","category-tools"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.aisoit.com\/index.php?rest_route=\/wp\/v2\/posts\/156","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.aisoit.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.aisoit.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.aisoit.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.aisoit.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=156"}],"version-history":[{"count":4,"href":"https:\/\/www.aisoit.com\/index.php?rest_route=\/wp\/v2\/posts\/156\/revisions"}],"predecessor-version":[{"id":275,"href":"https:\/\/www.aisoit.com\/index.php?rest_route=\/wp\/v2\/posts\/156\/revisions\/275"}],"wp:attachment":[{"href":"https:\/\/www.aisoit.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=156"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.aisoit.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=156"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.aisoit.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=156"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}