3

The LaTeX-Box plugin is supposed to define the command :Latexmk, but it doesn't! Am I missing something obvious?

(The reason I'm trying to run latexmk from vim is that I want to use the quickfix list. If anyone does this without a plugin, please let me know how.)

9
  • Is it just Latexmk that's not defined, or are other commands not defined either? How did you install it?
    – muru
    Commented Mar 21, 2016 at 11:28
  • @muru, not sure, I don't use any other commands from it. I installed it with vim-plug. … I just confirmed that omni-completion works. Help files are installed too, so it isn't that it simply didn't install. In case it might make a difference, I'm running nvim in a mac terminal.
    – Toothrot
    Commented Mar 21, 2016 at 11:40
  • 1
    On my system :Latexmk is available only when I'm editing a *.latex file, maybe you tried to use the command on another type of file?
    – statox
    Commented Mar 21, 2016 at 12:18
  • Latexmk available here too.
    – Niels
    Commented Mar 21, 2016 at 12:28
  • @statox, I see, that must be it. I call my latex files *.tex.
    – Toothrot
    Commented Mar 21, 2016 at 12:37

1 Answer 1

3

The reason is that LaTeX-Box loads some of its function only when the filetype of the buffer is set to tex. On some systems *.tex files's filetype is set to plaintext.

You have two options:

  • Renaming your files to *.latex
  • Adding autocmd! BufReadPost,BufNewFile *.tex set filetype=tex to your .vimrc to set the proper filetype to your *.tex files.
6
  • The second option doesn't work for me. Nor did let g:tex_flavor = 'latex' which I had before. set filetype? echos tex; but there is no :Latexmk.
    – Toothrot
    Commented Mar 21, 2016 at 14:38
  • @Lawrence: Ok that's really weird, I'll try to find another solution then
    – statox
    Commented Mar 21, 2016 at 15:11
  • Yeah, did you reproduce it? Maybe the decision whether or not to load latexmk.vim is made before the filetype is changed.
    – Toothrot
    Commented Mar 21, 2016 at 15:12
  • Yup I based my answer on my experimentation: on my system *.tex files's filetype was set to plaintext and :Latexmk wasn't available but the autocmd solved the problem.
    – statox
    Commented Mar 21, 2016 at 15:14
  • 1
    I think I found out where the problem lies. Your solution works when I load a tex file normally, with vi a.tex. But not when I load it through a list with `vi (backtick) cat toc (backtick).
    – Toothrot
    Commented Mar 21, 2016 at 15:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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