I have a BASH script that recompiles a latex document and reopens it up using my PDF reader when the buffer is written back. The command in my '.vimrc' looks like this:
autocmd BufWritePost *.tex !~/scripts/latex_update.sh %
This works well, but the reader always opens the PDF to the first page. This is inconvenient since I have to scroll to look at the changes I just made. I would like to set a VIM variable called 'page_num' and pass it as a second argument to my script.
I have tried this in VIM:
:let g:page_num=2
I then changed my 'autocmd' to:
autocmd BufWritePost *.tex !~/scripts/latex_update.sh % g:page_num
However, the global 'page_num' variable does not get replaced with its value. How can I get VIM to pass the value of 'page_num'?
Thanks!