diff --git a/.config/helix/config.toml b/.config/helix/config.toml index 7372b2d9..7bb3b6a5 100644 --- a/.config/helix/config.toml +++ b/.config/helix/config.toml @@ -184,11 +184,8 @@ C-u = ["page_cursor_half_up", "align_view_center"] # language specific commands [keys.normal.space.l] - -# typst -[keys.normal.space.l.t] -# open pdf preview -p = ':sh ~/.config/helix/scripts/typst-zathura.fish -k %{buffer_name}' +# open pdf preview for typst +p = ':sh ~/.config/helix/scripts/hx-typ-zathura.fish -k %{buffer_name}' # git stuff [keys.normal.space.g] diff --git a/.config/helix/scripts/typst-zathura.fish b/.config/helix/scripts/hx-typ-zathura.fish similarity index 78% rename from .config/helix/scripts/typst-zathura.fish rename to .config/helix/scripts/hx-typ-zathura.fish index c076cc95..1592999b 100755 --- a/.config/helix/scripts/typst-zathura.fish +++ b/.config/helix/scripts/hx-typ-zathura.fish @@ -1,14 +1,30 @@ #!/usr/bin/env fish + +# hx-typ-zathura: easily preview your typst documents from Helix! +# This script will automatically find a pdf that matches your +# current Typst document and attempt to open it with Zathura. +# Optionally, it will quit Zathura when you close Helix. +# Run this script with --help for usage info! + +# Author: Daniel Fichtinger ' + echo 'License: MIT' + return 0 end # only return status 1 if -q not set @@ -79,9 +95,10 @@ function zopen --wraps zathura # user didn't ask for watch, so open normally zathura "$argv[1]" &>/dev/null & end + true end -# try to find the target pdf file +# try to find the target pdf file searching from root function find_pdf set -l root $argv[1] set -l base $argv[2]