Commit: 7faefae108d46d93905d5d48d1a9306ca6d22aec
Parent: e23e7e713ee1a6ec3fc7c1bc1f9df749e470ce77
Author: Randy Palamar
Date: Fri, 16 Dec 2022 22:05:52 -0700
add texclean script and have vis run it on close
Diffstat:
2 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/.config/vis/visrc.lua b/.config/vis/visrc.lua
@@ -1,4 +1,5 @@
require('vis')
+require('util')
require('build')
require('macros')
@@ -21,3 +22,10 @@ end)
vis.events.subscribe(vis.events.WIN_OPEN, function(win)
vis:command("set rnu")
end)
+
+vis.events.subscribe(vis.events.WIN_CLOSE, function(win)
+ local f, e = splitext(win.file.name)
+ if e == '.tex' then
+ vis:command(string.format("!texclean %s", f .. e))
+ end
+end)
diff --git a/bin/texclean b/bin/texclean
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+# cleanup tex output clutter
+
+case "$1" in
+*.tex)
+ f=$(readlink -f "$1")
+ d=$(dirname "$f")
+ b="${f%.*}"
+ junk=$(find "$d" -type f | grep -E -e ".*\\.log" -e "^$b\\.(4tc|xref|tmp|pyc|pyg|pyo|fls|vrb|fdb_latexmk|bak|swp|aux|log|synctex\\(busy\\)|lof|lot|maf|idx|mtc|mtc0|nav|out|snm|toc|bcf|run\\.xml|synctex\\.gz|blg|bbl)")
+ rm $junk
+ ;;
+*) echo "usage: $0: file.tex" ;;
+esac