Skip to content

Instantly share code, notes, and snippets.

@endreszabo
Created January 10, 2015 22:27
Show Gist options
  • Save endreszabo/3e857337c2d80ed7949c to your computer and use it in GitHub Desktop.
Save endreszabo/3e857337c2d80ed7949c to your computer and use it in GitHub Desktop.
#!/bin/bash
# Tmux based TeX editor helper
EDITOR="${EDITOR:-vim}"
DOCUMENT="${1:-deriv}"
SESSIONID="tmuxtexex_${DOCUMENT}_$$"
tmux new-session -d -s "${SESSIONID}" && tmux new-window -t "${SESSIONID}:1" -n 'TmuxTeXEx' "$EDITOR ${DOCUMENT}.tex" && tmux split-window -v -l 6 -t "${SESSIONID}:1" "while :; do inotifywait -e modify \"${DOCUMENT}.tex\" && { make || pdflatex \"${DOCUMENT}.tex\" } && jobs %% || { evince \"${DOCUMENT}.pdf\" & }; done" && tmux select-pane -U -t "${SESSIONID}:1" && tmux -2 attach-session -t "${SESSIONID}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment