Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

When using Skim.app for reverse-searches, is there any way to make the .tex file come to the front if it's already open in a macvim tab? What if there are multiple vim windows open (not just tabs)?

The 'standard' script (http://sourceforge.net/apps/mediawiki/skim-app/index.php?title=TeX_and_PDF_Synchronization#Editor_Script_for_VIM) works if you have the file open in the active tab, but NOT if you have it open in a non-active tab (the vim command bufexists doesn't work for other tabs).

The Skim.app standard mvim --remote-silent +":%line" "%file" is, to me, completely useless - it overwrites the current open buffer on the first MacVim window open. Is there any way to change this behavior to find the current open copy of the file?

EDIT: A note I hope is helpful for others - I could not get the applescript to work at all until I added the line

  -e "delay 0.2" \

to the start of the script and changed the ESC key passing to be

-e "    key code 53 "\
share|improve this question

1 Answer 1

up vote 2 down vote accepted

My answer is this plugin/script pair:

See http://stackoverflow.com/questions/8839846/vim-check-if-a-file-is-open-in-current-tab-window-and-activate-it for details

Short summary: WhichTab.vim searches through all tabs in a macvim session for your filename (hopefully you don't have too many files opened named ms.tex....).

macvim-load-line runs WhichTab on each open VIM GUI window, then if it finds an open copy of the file, it activates that GUI window, switches to that tab, and goes to that line.

Right now the only thing it doesn't do is open a .tex file if it's not already open... which for me, is rarely/never the case if I'm actively editing. But that should be trivial to add.

share|improve this answer
I'm not sure if this is happening for others, but your first two links are broken: WhichTab and macvim-load-line. –  user2473 Jan 25 '12 at 23:58
@CJF - thanks; I moved the files and forgot to update the link. Should be fixed now. –  keflavich Jan 26 '12 at 0:43

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.