From: Tucker Johnson Date: Tue, 25 Feb 2025 22:44:28 +0000 (-0500) Subject: getcomp X-Git-Url: https://git.newer.systems/?a=commitdiff_plain;h=5aebd3459372e6dad6077f9b9f29221baada16b8;p=nvim.git getcomp --- diff --git a/scripts/getcomproot b/scripts/getcomproot new file mode 100755 index 0000000..d34a2e4 --- /dev/null +++ b/scripts/getcomproot @@ -0,0 +1,12 @@ +#!/bin/bash + +# A helper script for LaTeX/groff files used by `compiler` and `opout`. +# The user can add the root file of a larger project as a comment as below: +# % root = mainfile.tex +# And the compiler script will run on that instead of the opened file. + +texroot="$(grep -i "^.\+\s*root\s*=\s*\S\+" "$1")" +texroot="${texroot##*=}" +texroot="${texroot//[\"\' ]}" + +[ -f "$texroot" ] && readlink -f "$texroot" || exit 1