From d09584e69020878e9e9b20baadab88d04cce783b Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Fri, 13 Jan 2023 00:04:21 +0100 Subject: [PATCH] scripts: Remove compile script Never used the compile script for years now, and I neither see that changing nor the files being of any use anymore. They were something I whipped up when I first started getting into Linux and bash scripting (and as such a little nostalgic I suppose) but nothing that has actual purpose anymore. --- nvim/.config/nvim/lua/maps.lua | 9 --- .../nvim/plugin/personal/doccompile.vim | 25 ------- scripts/.local/bin/compile | 70 ------------------- scripts/.local/bin/open-compiled | 28 -------- 4 files changed, 132 deletions(-) delete mode 100644 nvim/.config/nvim/plugin/personal/doccompile.vim delete mode 100755 scripts/.local/bin/compile delete mode 100755 scripts/.local/bin/open-compiled diff --git a/nvim/.config/nvim/lua/maps.lua b/nvim/.config/nvim/lua/maps.lua index c0a1c41..5b43433 100644 --- a/nvim/.config/nvim/lua/maps.lua +++ b/nvim/.config/nvim/lua/maps.lua @@ -207,15 +207,6 @@ map.n.nore['ZG'] = ':setlocal spell! spelllang=de_de' map.i.nore[''] = 'u[s1z=`]au' map.n.nore['s'] = 'ms[s1z=`s' --- pp to comPile a document (or file, works for some languages like go/python/c) --- o to open the resulting document (mostly for pdfs) --- po to comPile *and* open a doc --- and all the same in uppercase for verbose output -map.n.nore['dp'] = ':DocCompile' -map.n.nore['dP'] = ':DocCompile!' -map.n.nore['do'] = ':DocOpen' -map.n.nore['dO'] = ':DocOpen!' - -- PLUGIN: easy-align -- Start interactive EasyAlign in visual mode (e.g. vipga) map.x['ga'] = '(EasyAlign)' diff --git a/nvim/.config/nvim/plugin/personal/doccompile.vim b/nvim/.config/nvim/plugin/personal/doccompile.vim deleted file mode 100644 index 83d361b..0000000 --- a/nvim/.config/nvim/plugin/personal/doccompile.vim +++ /dev/null @@ -1,25 +0,0 @@ -function s:_compile(verbose, ...) - :execute(":w!") - if a:verbose - execute "!" . "compile" . " " . "\"%:p\"" . " " . join(a:000) - else - silent execute "!" . "compile" . " " . "\"%:p\"" . " " . join(a:000) - endif -endfunction - -function s:_open(verbose, ...) - if a:verbose - execute "!" . "open-compiled" . " " . "\"%\"" . " " . join(a:000) - else - silent execute "!" . "open-compiled" . " " . "\"%\"" . " " . join(a:000) - endif -endfunction - -function s:_compileopen(verbose, ...) - call s:_compile(a:verbose, join(a:000)) - call s:_open(a:verbose, join(a:000)) -endfunction - -command -bang -nargs=* DocCompile call s:_compile(0, ) -command -bang -nargs=* DocCompileOpen call s:_compileopen(0, ) -command -bang -nargs=* DocOpen call s:_open(0, ) diff --git a/scripts/.local/bin/compile b/scripts/.local/bin/compile deleted file mode 100755 index 4a38bc7..0000000 --- a/scripts/.local/bin/compile +++ /dev/null @@ -1,70 +0,0 @@ -#!/usr/bin/env sh - -# from https://github.com/LukeSmithxyz/voidrice/blob/master/.local/bin/compiler -# -# This script will compile or run another finishing operation on a document. I -# have this script run via vim. -# -# Compiles .tex. groff (.mom, .ms), .rmd, .md. Opens .sent files as sent -# presentations. Runs scripts based on extention or shebang -# -# Expects the file to compile as first argument. -# Desired output format(s) can be specified in optional arguments following. - -file=$1 -if [ ! -f "$file" ]; then - echo "File does not exist." - exit 1 -else - printf "file: %s\n" "$file" -fi - -if [ "$#" -gt 1 ]; then - shift - formats="$*" -fi - -dir=$(dirname "$file") -base="${file%.*}" - -cd "$dir" || exit - -textype() { - if (sed 5q "$file" | grep -i -q 'xelatex') && exist xelatex; then - command="xelatex" - elif exist pdflatex; then - command="pdflatex" - fi - $command --output-directory="$dir" "$base" && - grep -i addbibresource "$file" >/dev/null && - biber --input-directory "$dir" "$base" && - $command --output-directory="$dir" "$base" && - $command --output-directory="$dir" "$base" -} - -sendtoRmd() { - printf "formats: %s\n" "$formats" - ## FIXME this is horribly inefficient, should just pass all formats to R - # but R expects them as "strings" and I don't know how to quote the individual words - if [ -n "$formats" ]; then - for fmt in $formats; do - exist R critical && echo "require(rmarkdown); render('$1', c(\"$fmt\"))" | R -q --vanilla - done - else - exist R critical && echo "require(rmarkdown); render('$1')" | R -q --vanilla - fi -} - -case "$file" in -*\.ms) refer -PS -e "$file" | groff -me -ms -kept -T pdf >"$base".pdf ;; -*\.mom) refer -PS -e "$file" | groff -mom -kept -T pdf >"$base".pdf ;; -*\.[0-9]) refer -PS -e "$file" | groff -mandoc -T pdf >"$base".pdf ;; -*\.[Rr]md | *\.md | *\.mkd | *\.markdown) sendtoRmd "$file" "$formats" ;; -*\.tex) textype "$file" ;; -*config.h) sudo make install ;; -*\.c) cc "$file" -o "$base" && "$base" ;; -*\.py) python "$file" ;; -*\.go) go run "$file" ;; -*\.sent) setsid sent "$file" 2>/dev/null &;; -*) sed 1q "$file" | grep "^#!/" | sed "s/^#!//" | xargs -r -I % "$file" ;; -esac diff --git a/scripts/.local/bin/open-compiled b/scripts/.local/bin/open-compiled deleted file mode 100755 index 489180b..0000000 --- a/scripts/.local/bin/open-compiled +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env sh - -# opout: "open output": A general handler for opening a file's intended output, -# usually the pdf of a compiled document. I find this useful especially -# running from vim. -# -# from https://github.com/LukeSmithxyz/voidrice/tree/master/.local/bin - -basename="$(echo "$1" | sed 's/\.[^\/.]*$//')" - -openCompiledDoc() { - if [ -f "$basename".pdf ]; then - setsid "$FILEREADER" "$basename.pdf" - elif [ -f "$(echo "$basename" | sed 's/ /-/g')".pdf ]; then - setsid "$FILEREADER" "$(echo "$basename" | sed 's/ /-/g').pdf" - elif [ -f "$(echo "$basename" | sed 's/ /_/g')".pdf ]; then - setsid "$FILEREADER" "$(echo "$basename" | sed 's/ /_/g').pdf" - elif [ -f "$basename".html ]; then - setsid "$BROWSER" "$basename.html" - fi -} - -case "$1" in - # *.tex|*.md|*.rmd|*.ms|*.me|*.mom) setsid "$FILEREADER" "$basename".pdf >/dev/null 2>&1 & ;; - *.tex|*.md|*.[Rr]md|*.ms|*.me|*.mom) openCompiledDoc >/dev/null 2>&1 & ;; - *.[0-9]) openCompiledDoc >/dev/null 2>&1 & ;; - *.html) openCompiledDoc >/dev/null 2>&1 & ;; -esac