From eec9a0315f05fad89cfd8c359d26cb30f6f19592 Mon Sep 17 00:00:00 2001 From: stuebinm Date: Sun, 19 Mar 2023 23:17:11 +0100 Subject: home: mds alias to read markdown files --- home/home-minimal.nix | 8 ++++++++ home/home.nix | 2 +- home/packages-minimal.nix | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/home/home-minimal.nix b/home/home-minimal.nix index f28240a..dc39d9d 100644 --- a/home/home-minimal.nix +++ b/home/home-minimal.nix @@ -57,6 +57,14 @@ fish_greeting = { body = ""; }; + mds.body = '' + if [ "$argv[1]" = "" ] + set pattern ".md" + else + set pattern $argv[1] + end + fd $pattern | fzf --preview="glow {} --style=dark" --bind ctrl-j:preview-down,ctrl-k:preview-up,ctrl-alt-j:preview-page-down,ctrl-alt-k:preview-page-up + ''; }; }; diff --git a/home/home.nix b/home/home.nix index 74f6bde..604f490 100644 --- a/home/home.nix +++ b/home/home.nix @@ -59,7 +59,7 @@ echo "No url given" return end - set choice (curl $url | rg -e ']*href="([^"]*\.pdf)"[^>]*>([^<]*)' -o | sed 's/]*href="\([^"]*\)"[^>]*>\(.*\)<\/a>/"\1" "\2"/g' | fzf) + set choice (curl -L $url | rg -e ']*href="([^"]*\.pdf)"[^>]*>([^<]*)' -o | sed 's/]*href="\([^"]*\)"[^>]*>\(.*\)<\/a>/"\1" "\2"/g' | fzf) if test "$status" != 0 return end diff --git a/home/packages-minimal.nix b/home/packages-minimal.nix index 5dbc7a2..17f4aa1 100644 --- a/home/packages-minimal.nix +++ b/home/packages-minimal.nix @@ -15,7 +15,7 @@ tree dnsutils inetutils pijul bat age libsecret gping bottom dogdns cifs-utils jekyll fzf ripgrep fd sd bandwhich exa dive ripgrep python39Packages.isort shellcheck graphviz - zip unzip acpi sfz viu + zip unzip acpi sfz viu glow yt-dlp weechat hexyl bottom lm_sensors usbutils # git -- cgit v1.2.3