Vimtex: `let g:vimtex_view_method = 'skim'` opens the document in Preview.app

Created on 2 Aug 2017  路  7Comments  路  Source: lervag/vimtex

I'm setting up vimtex for use on macOS Sierra in MacVim (8.0.771). I'd like to preview the document in Skim, so I added let g:vimtex_view_method = 'skim' to my .vimrc. However, <leader>lv opens the document in the default Preview.app instead. There are no errors, and I know that it recognizes the command because :VimtexInfo contains the line viewer: Skim. My .latexmkrc file is empty.

Minimal vimrc file:

set nocompatible

call plug#begin('~/.vim/plugged')
Plug 'lervag/vimtex'
call plug#end()

let g:vimtex_view_method = 'skim'

I've tried using more complicated setups, such as the ones discussed in #204, but they all lead to the same issue. For what it's worth, as a test I tried setting g:vimtex_view_method = 'mupdf' which gives an error stating that "MuPDF is not an executable" which is expected as I don't have it installed.

Most helpful comment

You were right: I have vim-polyglot installed and adding the line let g:polyglot_disabled = ['latex'] to my .vimrc completely fixes everything. Sorry for missing something which should have been pretty obvious, and thanks so much for your help!

All 7 comments

What happens if you try to open Skim in a terminal?

You can see which command is used in the VimtexInfo.

Skim opens normally using open -a Skim from the terminal.

I found that if I set the system default pdf viewer to be Skim, then the document does open in Skim. So, I think it's using the default viewer instead of the one specified by vimtex. However, even when the document opens in Skim, it doesn't compile the document continuously as is specified by the vimtex default values:

  compiler: latexmk
    backend: jobs
    output: /var/folders/k6/qt_68h7916j1lb7pd5sw44sm0000gn/T/vRej0Hp/1
    configuration:
      continuous: 1
      callback: 1
      latexmk options:
        -verbose
        -pdf
        -file-line-error
        -synctex=1
        -interaction=nonstopmode
  viewer: Skim

This is taken from my VimtexInfo, and matches the default values listed in the documentation. Altogether, it seems like these configuration options are never being used. I saw that issue #523 looked similar to mine, but the solution that worked there didn't have any effect for me.

What happens if you try to open Skim in a terminal with the Skim path directly, that is, try to use the same command that is run by vimtex.

Also, opening the viewer with \lv does not have anything to do with compilation. To compile the document, use \ll or :VimtexCompile. This should, by default, start continuous compilation. If you have an issue with this, please open a new issue.

From #523, running /Applications/Skim.app/Contents/SharedSupport/displayline -r 1 test.pdf test.tex from the terminal opens the pdf in Skim. Is this the command that's run by vimtex?

I've been compiling the document using \ll which flashes Compiling to pdf... briefly at the bottom of the screen, followed by \lv which opens the pdf in the default viewer. \ll doesn't start continuous compilation for me: following it with \lk gives latexmk is not running for 'test'.

However, after reading your reply I tried running :VimtexCompile which actually _does_ start continuous compilation! Furthermore, entering :VimtexView instead of \lv opens the pdf in Skim with all the expected features even when Skim isn't the default viewer.

Looking through the documentation again, I see that both \ll and :VimtexInfo should map to <plug>(vimtex-compile), and both \lv and :VimtexView should map to <plug>(vimtex-view). So I guess the issue all along has been that \ll and \lv aren't working as expected in my case? It's also very possible that I've just misunderstood something, I'm pretty new to Vim plugins and working with LaTeX on my own system.

First, the command used by vimtex can be found after you have done \lv from :VimtexInfo.

However, I expect that there might be a conflic between plugins. Can you paste the content of :scriptnames here? In particular, I suspect that you either have something like LaTeX-Box or vim-latex/latex-suite installed (perhaps not by intention). I know that LaTeX-Box comes with vim-polyglot, and so if you use this plugin you should disable LaTeX-Box (read the docs).

You were right: I have vim-polyglot installed and adding the line let g:polyglot_disabled = ['latex'] to my .vimrc completely fixes everything. Sorry for missing something which should have been pretty obvious, and thanks so much for your help!

No problem, happy to help :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vsbuffalo picture vsbuffalo  路  3Comments

David-Fu picture David-Fu  路  5Comments

itsShnik picture itsShnik  路  5Comments

chakravala picture chakravala  路  5Comments

vanabel picture vanabel  路  6Comments