1
0
mirror of https://github.com/tiyn/dotfiles.git synced 2025-10-09 19:11:15 +02:00

tools: restructured

This commit is contained in:
2023-11-10 13:55:20 +01:00
parent 4cf03f336e
commit 1547250832
38 changed files with 0 additions and 0 deletions

6
.local/bin/etc/nvim/cclear Executable file
View File

@@ -0,0 +1,6 @@
#!/bin/sh
if [ -d .ccls-cache ]
then
rm -r '.ccls-cache'
fi

46
.local/bin/etc/nvim/compiler Executable file
View File

@@ -0,0 +1,46 @@
#!/usr/bin/env sh
# 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
# by lukesmithxyz, checkout github.com/lukesmithxyz/voidrice
file=$(readlink -f "$1")
dir=$(dirname "$file")
base="${file%.*}"
basenodir="${1%.*}"
cd "$dir" || exit
textype() { \
command="pdflatex"
( sed 5q "$file" | grep -i -q 'xelatex' ) && command="xelatex"
$command --output-directory="$dir" "$base" &&
grep -i addbibresource "$file" >/dev/null &&
biber --input-directory "$dir" "$base" &&
$command --output-directory="$dir" "$base" &&
makeglossaries "$basenodir" &&
$command --output-directory="$dir" "$base"
}
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 ;;
*\.rmd) echo "require(rmarkdown); render('$file')" | R -q --vanilla ;;
*\.m) octave -qW "$file" ;;
*\.md) pandoc "$file" --pdf-engine=xelatex -o "$base".pdf ;;
*config.h) sudo make install ;;
*\.tex) textype "$file" ;;
*\.java) java "$file" ;;
*\.js) node "$file" ;;
*\.c) if [ -f Makefile ]; then make run; else cc "$file" -o "$base" && "$base"; fi ;;
*\.nim) nim c -r -d:noColors "$file" ;;
*\.py) python "$file" ;;
*\.go) go run "$file" ;;
*\.lua) lua "$file" ;;
*\.sent) setsid sent "$file" 2>/dev/null & ;;
*\.r|*\.R) Rscript "$file" ;;
*) sed 1q "$file" | grep "^#!/" | sed "s/^#!//" | xargs -r -I % "$file" ;;
esac

16
.local/bin/etc/nvim/texclear Executable file
View File

@@ -0,0 +1,16 @@
#!/usr/bin/env sh
# Clears the build files of a LaTeX/XeLaTeX build.
# I have vim run this file whenever I exit a .tex file.
# by lukesmithxyz, checkout github.com/lukesmithxyz/voidrice
case "$1" in
*.tex)
file=$(readlink -f "$1")
dir=$(dirname "$file")
base="${file%.*}"
if [ -f "$dir/indent.log" ]; then rm "$dir/indent.log"; fi
find "$dir" -maxdepth 1 -type f -regextype gnu-awk -regex "^$base\\.(4tc|xref|tmp|pyc|pyo|fls|vrb|fdb_latexmk|bak|swp|log|synctex\\(busy\\)|lof|lot|maf|idx|mtc|mtc0|nav|out|snm|toc|loa|bcf|run\\.xml|synctex\\.gz|blg|bbl|glg|glo|gls|glsdefs|ilg|ist|acn|acr|alg|toc)" -delete ;
find "$dir" -maxdepth 1 -type f -regextype gnu-awk -regex ".*\\.aux" -delete ;;
*) printf "Give .tex file as argument.\\n" ;;
esac