I'm trying to set up Vim to detect when a .tex file contains the command '\usepackage{sagemath}', and run a command accordingly. I've gotten to
:au BufReadPost,BufWritePost *.tex TTarget sagepdf
but that will fire for all .tex files, which isn't what I want.