Don't really know where to begin. I have installed the latest macvim and skim. Put the mvim in path. Setup skim sync with the default macvim (and tried some custom stuff also). However it will not sync no matter what I do. Sync works between skim and textmate though.

Anyone able to guide me in some direction would be very much appreciated.

  • Welcome to TeX.SX. I use vim myself but not on the Mac. Would you mind explaining what skim and syncing is all about?
    – user10274
    Commented Feb 20, 2012 at 1:45
  • Skim is a pdf reader that supports synchronization between the pdf file and the tex file simply by cmd+shift+click. Thus where you click in the pdf you will be taken there in the tex file. Very handy when writing large reports and stuff like that. Commented Feb 20, 2012 at 8:34
  • Thanks. I found the information yesterday. I don't use the software, but you may want to explain how you set up macvim and provide a minial example file. All I could find about configuration is this link.
    – user10274
    Commented Feb 20, 2012 at 8:43

7 Answers 7


I think you need to use the option --synctex=1. Actually in the most popular editors on the mac, the value used by default is 1. For using SyncTeX with your document just call pdflatex with the --synctex=1 option or place \synctex=1 in your documents preamble.

For more instructions about synchronisation between MacVim and Skim, you can read this article MacVim_Skim

Remark 1 : like egreg writes \usepackage{pdfsync} is obsolete with the last pdftex engine.

Remark 2 : TextMate 1 is not free but the synchronisation is fine with Skim.

Remark 3 : TeXShop has the better synchronisation with two methods.

Remark 4 : A new free (at present) editor arrived only for the Mac: TeXnicle. It's a remarkable project manager but I don't know if synchronisation is possible. After a quick try, the synchronisation is fine from tex -> pdf but there is a problem with pdf-> tex.

  • Google with MacVim Skim gives a lot of results about your problem. If your problem persists, you can ask a question to the author of Skim, he will answer you quickly. Commented Feb 20, 2012 at 7:50
  • I have the '--synctex=1' option on, still does not work. And I have done what the link told me to do - still does not work. I have searched google for 4 hours or so - and no results really covered my problem, since it seems to work for everyone, but me. I tried deleting all skim preference and reinstall - also earlier version - to no avail. Also I have a vimrc from a friend of mine where the sync works just fine. Commented Feb 20, 2012 at 8:27
  • 2
    1) What is the result in the terminal of $echo $PATH ? 2)To enable the synchro in skim, you have only to choice in the pref MacVim and you get : --remote-silent +":%line" "%file" and the script is mvim. In the terminal $which mvim gives the path of mvim then in the pref of skim, you choice macVim first then "other or personalized" and for the command instead mvim you write the result of $which mvim Commented Feb 20, 2012 at 9:16
  • @Alain Your last comment solved it for me, even though plain mvim is in my path. Skim still doesn’t find it unless the absolute path is specified. Maybe the answer should be updated to include this information. The remark “TeXShop has better synchronisation” also isn’t quite true: once this problem is solved: MacVim’s synchronisation is just as good. Finally, the TeXnicle link is dead. Commented Oct 3, 2013 at 17:41

I realize this is an old question; maybe you still have the issue though.

I had this same problem just now and finally solved it by editing the file compiler.vim in ~/.vim/ftplugin/latex-suite directly. Tossing in a few echos here and there, I noticed that it was taking the branch of the conditional to pick an editor that was for UNIX instead of picking Skim for Mac OS X. I ended up just deleting all the other possibilities for it to launch the viewer, though you could do this more elegantly / better-preserving compatibility by figuring out which parameter is causing it to take the wrong branch of the conditional and then re-coding / debugging accordingly.

For reference, here are my fixed ~/.vim/ftplugin/tex.vim and the relevant segment of ~/.vim/ftplugin/latex-suite/compiler.vim (this replaces the function Tex_ForwardSearchLaTeX(); my function Tex_ViewLaTeX() worked right off the bat but you may need to modify that function similarly).

    " this is mostly a matter of taste. but LaTeX looks good with just a bit
    " of indentation.
    set sw=2
    " TIP: if you write your \label's as \label{fig:something}, then if you
    " type in \ref{fig: and press <C-n> you will automatically cycle through
    " all the figure labels. Very useful!
    set iskeyword+=:

    let g:tex_flavor = 'latex'

    let g:Tex_MultipleCompileFormat = 'pdf,aux'
    let g:Tex_TreatMacViewerAsUNIX = 0
    let g:Tex_DefaultTargetFormat = 'pdf'
    let g:Tex_CompileRule_pdf = 'pdflatex -synctex=1 --interaction=nonstopmode $*'
    let g:Tex_ViewRule_pdf = 'Skim'

    " Command-R will write, compile, and forward search--thanks to
    " http://reference-man.blogspot.com/2011/09/fully-integrated-latex-in-macvim.html
    " preview, switch back to main window
    map <D-r> :w<cr><leader>ll<leader>ls
    imap <D-r> <ESC><D-r>

    let g:Tex_IgnoredWarnings ='
          \"specifier changed to\n".
          \"You have requested\n".
          \"Missing number, treated as zero.\n".
          \"There were undefined references\n".
          \"Citation %.%# undefined\n".
          \"Marginpar on page %.%# moved\n".
          \"\oval, \circle, or \line size unavailable\n"' 

The relevant additions are the ones of the form let g:tex etc.

Skim is set as below, which assumes as you mentioned that you copied mvim to that location or added it somewhere in $PATH etc.

screenshot of Skim settings

Finally the changes to compiler.vim starting at line 324:

    function! Tex_ForwardSearchLaTeX()
        if &ft != 'tex'
            echo "calling Tex_ForwardSeachLaTeX from a non-tex file"

        if Tex_GetVarValue('Tex_ViewRule_'.s:target) == ''

        let viewer = Tex_GetVarValue('Tex_ViewRule_'.s:target)
        let s:origdir = fnameescape(getcwd())

        let mainfname = Tex_GetMainFileName(':t')
        let mainfnameRoot = fnamemodify(Tex_GetMainFileName(), ':t:r')
        let mainfnameFull = Tex_GetMainFileName(':p:r')
        " cd to the location of the file to avoid problems with directory name
        " containing spaces.
        call Tex_CD(Tex_GetMainFileName(':p:h'))

        if viewer =~ "^ *Skim"
            let execString = 'silent! !/Applications/Skim.app/Contents/SharedSupport/displayline '.
                \ line('.').' "'.mainfnameFull.'.'.s:target.'" "'.expand("%:p").'"'

        elseif viewer =~ "^ *PDFView"

            let execString = 'silent! !/Applications/PDFView.app/Contents/MacOS/gotoline.sh '.
                \ line('.').' "'.mainfnameFull.'.'.s:target.'" "'.expand("%:p").'"'

        elseif viewer =~ "^ *TeXniscope"

            let execString = 'silent! !/Applications/TeXniscope.app/Contents/Resources/forward-search.sh '.
                \ line('.').' "'.expand("%:p").'" "'.mainfnameFull.'.'.s:target.'"'


        call Tex_Debug("Tex_ForwardSearchLaTeX: execString = ".execString, "comp")
        execute execString
        if !has('gui_running')

        exe 'cd '.s:origdir

Again, obviously, this was just a quick-and-dirty way to edit compiler.vim and I stopped caring once it worked, so you could make these either more compatible by not removing so many cases of the conditional or more elegant by just skipping the conditional altogether...I'm just wary of jinxing it now that it works ;)

Note: if you need step-by-step instructions for opening and editing these files, please leave a comment...believe me I've been frustrated by how much the related manuals / help files on the interwebs assume you already know how to do with software you're obviously new to, and I'd be glad to walk you through it in as much detail as you need to save you from the same frustration.

Note 2: I believe this is the full extent of changes to the default installation that I have made, but I could have left one out since I've been working on this so much. If this does not work for you, let me know and I'll look into what else I may have incidentally changed.


I had to set the following in my .vimrc to get <leader>lv to work correctly:

autocmd FileType tex call Tex_SetTeXCompilerTarget('View','pdf')                                                                                                                     

I hope it helps someone :)



Another possibility to Interlink macvim & skim for an integrated LaTeX DE provides following github repo: https://github.com/keflavich/macvim-skim

It consists of:

  1. a bash script macvim-load-line
  2. a vim function WhichTab
  3. a vim ft-plugin which configures correct forward-search calls
  4. and an installer file. This one copies the bash script into $PATH, moves vim files to the right location in ~/.vim and configures the settings of Skim.

If you already have an ftplugin for tex (such as vimtex or latex-box), you can remove the ftplugin of macvim-skim and use the forward search capabilities provided by vimtex or latex-box.


You may need to add


to your preamble to generate the necessary data for the sync.

  • 1
    Note that the pdfsync method is obsolete and is not at all concerned about the Elithraldor problem.
    – egreg
    Commented Feb 20, 2012 at 6:41

I wasn't able to figure out how to make this work with MacVim, and tried a number of the script samples that are floating around. I resorted to the following:



[ "${file:0:1}" == "/" ] || file="${PWD}/$file"

exec $xt -fn 10x20 -geometry 110x30 -fg green -bg black -e "vim +$line $file"

This doesn't have the menus that MacVim has, but at least it actually brings up vim.


vim-latex and Skim.app


vim-latex offers a convenient vimscript function called RemoteOpen to improve the backwards search. The given description explains what it does:

" Often times, an external program needs to open a file in gvim from the
" command line. However, it will not know if the file is already opened in a
" previous vim session. It is not sufficient to simply specify 
" gvim --remote-silent <filename> 
" because this simply opens up <filename> in the first remote gvim session it
" sees. This script provides a command RemoteOpen which is meant to be used
" from the command line as follows:
" gvim -c ":RemoteOpen +<lnum> <filename>"
" where <lnum> is the line-number you wish <filename> to open to.  What will
" happen is that a new gvim will start up and enquire from all previous
" sessions if <filename> is already open in any of them. If it is, then it
" will edit the file in that session and bring it to the foreground and itself
" quit. Otherwise, it will not quit and instead open up the file for editing
" at <lnum>.

Skim.app can be configured to use mvim which is a command line script to open macvim. mvim is distributed with macvim, however, has to be installed into $PATH manually, see :h mvim. The correct Skim.app configuration looks like this:

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .