For the first situation (tex selection to PDF) if you have a tex compiler that allows for input from stdin you could echo your visual selection.
function! EchoPipeCmd(cmd) range
echo system('echo ' . shellescape(join(getline(a:firstline, a:lastline), "\n")) . ' | ' . a:cmd)
command! -range=% -nargs=+ EchoPipeCmd :<line1>,<line2>call EchoPipeCmd(<q-args>)
If you visually selection a block and enter
:'<,'>EchoPipeCmd command the selection is sent to
/bin/echo as an escaped string and then piped to the command you provide. As an example
:'<,'>EchoPipeCmd tee /tmp/output.txt
tee to both echo the selected text and also write it to
If you want to make a command and hardcode in the tex compiler info you'd do something like this (assuming the command to compile is
tex --stdin -o <filename>)
command! -range=% -nargs=0 CompileTex :<line1><line2>call EchoPipeCmd("tex --stdin -o /tmp/output.pdf")
Now you can visually select and call
:'<,'>CompileTex and you'll get a pdf file.