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.
This commit is contained in:
parent
0a867ee992
commit
d09584e690
4 changed files with 0 additions and 132 deletions
|
@ -207,15 +207,6 @@ map.n.nore['<localleader>ZG'] = ':setlocal spell! spelllang=de_de<cr>'
|
||||||
map.i.nore['<c-s>'] = '<C-G>u<Esc>[s1z=`]a<C-G>u'
|
map.i.nore['<c-s>'] = '<C-G>u<Esc>[s1z=`]a<C-G>u'
|
||||||
map.n.nore['<localleader>s'] = 'ms[s1z=`s'
|
map.n.nore['<localleader>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['<leader>dp'] = ':DocCompile<cr>'
|
|
||||||
map.n.nore['<leader>dP'] = ':DocCompile!<cr>'
|
|
||||||
map.n.nore['<leader>do'] = ':DocOpen<cr>'
|
|
||||||
map.n.nore['<leader>dO'] = ':DocOpen!<cr>'
|
|
||||||
|
|
||||||
-- PLUGIN: easy-align
|
-- PLUGIN: easy-align
|
||||||
-- Start interactive EasyAlign in visual mode (e.g. vipga)
|
-- Start interactive EasyAlign in visual mode (e.g. vipga)
|
||||||
map.x['ga'] = '<Plug>(EasyAlign)'
|
map.x['ga'] = '<Plug>(EasyAlign)'
|
||||||
|
|
|
@ -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(<bang>0, <f-args>)
|
|
||||||
command -bang -nargs=* DocCompileOpen call s:_compileopen(<bang>0, <f-args>)
|
|
||||||
command -bang -nargs=* DocOpen call s:_open(<bang>0, <f-args>)
|
|
|
@ -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
|
|
|
@ -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
|
|
Loading…
Reference in a new issue