lervag / vimtex

VimTeX: A modern Vim and neovim filetype plugin for LaTeX files.
MIT License
5.43k stars 389 forks source link

Compile tex, skim is not responding #2589

Closed PEKEW closed 1 year ago

PEKEW commented 1 year ago

Description

Hi, I configured vimtex with NeoVIM, but previewing with skim is frequently not responding when I compile a tex file. The timeline of the issue is as follows:

my config:

if ( g:is_win || g:is_mac ) && executable('latex')
  " Hacks for inverse search to work semi-automatically,
  " see https://jdhao.github.io/2021/02/20/inverse_search_setup_neovim_vimtex/.
  function! s:write_server_name() abort
    let nvim_server_file = (has('win32') ? $TEMP : '/tmp') . '/vimtexserver.txt'
    call writefile([v:servername], nvim_server_file)
  endfunction

  augroup vimtex_common
    autocmd!
    autocmd FileType tex call s:write_server_name()
    autocmd FileType tex nmap <buffer> <F9> <plug>(vimtex-compile)
  augroup END

  let g:vimtex_compiler_latexmk = {
        \ 'build_dir' : 'build',
        \ }

  " TOC settings
  let g:vimtex_toc_config = {
        \ 'name' : 'TOC',
        \ 'layers' : ['content', 'todo', 'include'],
        \ 'resize' : 1,
        \ 'split_width' : 30,
        \ 'todo_sorted' : 0,
        \ 'show_help' : 1,
        \ 'show_numbers' : 1,
        \ 'mode' : 2,
        \ }

    "let g:vimtex_view_general_viewer = '/Applications/Skim.app/Contents/SharedSupport/displayline'
    "let g:vimtex_view_general_options = '-r @line @pdf @tex'
"    let g:vimtex_view_method = 'skim'
let g:vimtex_compiler_progname = 'nvr'
let g:vimtex_compiler_latexmk = {
\ 'backend' : 'nvim',
\ 'background' : 1,
\ 'build_dir' : '',
\ 'callback' : 1,
\ 'continuous' : 1,
\ 'executable' : 'latexmk',
\ 'options' : [
\ '-pvc',
\ '-shell-escape',
\ '-verbose',
\ '-file-line-error',
\ '-synctex=1',
\ '-interaction=nonstopmode',
\ ]}

endif

Steps to reproduce

No response

Expected behavior

No response

Actual behavior

No response

Do you use a latexmkrc file?

No

VimtexInfo

System info:
  OS: macOS 12.3 (21E230)
  Vim version: NVIM v0.8.0
  Has clientserver: true
  Servername: /var/folders/qz/fnb_5_7101l4_5_m58kxxc_40000gn/T/nvim.mac/VZX7Ix/nvim.39759.0

VimTeX project: New_IEEEtran_how-to
  base: New_IEEEtran_how-to.tex
  root: /Volumes/H/conserved sequence/IEEE-Transactions-LaTeX2e-templates-and-instructions
  tex: /Volumes/H/conserved sequence/IEEE-Transactions-LaTeX2e-templates-and-instructions/New_IEEEtran_how-to.tex
  main parser: current file verified
  document class: IEEEtran
  packages: algorithm algorithmic amsbsy amsfonts amsgen amsmath amsopn amstext array balance caption3 epstopdf-base float graphics graphicx ifthen keyval stfloats subfig textcomp trig url verbatim
  compiler: latexmk
    engine: -pdf
    options:
      -pvc
      -shell-escape
      -verbose
      -file-line-error
      -synctex=1
      -interaction=nonstopmode
    callback: 1
    continuous: 1
    executable: latexmk
  viewer: General
  qf method: LaTeX logfile
lervag commented 1 year ago

Your config is messy and not quite up to date. I would strongly recommend that you read the documentation, e.g. :help g:vimtex_view_method and :help vimtex-view.

I think you can replace all of the config you showed my with this:

augroup vimtex_common
  autocmd!
  autocmd FileType tex nmap <buffer> <F9> <plug>(vimtex-compile)
augroup END

let g:vimtex_view_method = 'skim'

let g:vimtex_compiler_latexmk = {
      \ 'build_dir' : 'build',
      \ 'options' : [
      \ '-shell-escape',
      \ '-verbose',
      \ '-file-line-error',
      \ '-synctex=1',
      \ '-interaction=nonstopmode',
      \ ]}

let g:vimtex_toc_config = {
      \ 'name' : 'TOC',
      \ 'layers' : ['content', 'todo', 'include'],
      \ 'resize' : 1,
      \ 'split_width' : 30,
      \ 'todo_sorted' : 0,
      \ 'show_help' : 1,
      \ 'show_numbers' : 1,
      \ 'mode' : 2,
      \ }
PEKEW commented 1 year ago

Thank you very much for your help, I am not very familiar with the configuration of vim. I used your config and now everything is OK

Your config is messy and not quite up to date. I would strongly recommend that you read the documentation, e.g. :help g:vimtex_view_method and :help vimtex-view.

I think you can replace all of the config you showed my with this:

augroup vimtex_common
  autocmd!
  autocmd FileType tex nmap <buffer> <F9> <plug>(vimtex-compile)
augroup END

let g:vimtex_view_method = 'skim'

let g:vimtex_compiler_latexmk = {
      \ 'build_dir' : 'build',
      \ 'options' : [
      \ '-shell-escape',
      \ '-verbose',
      \ '-file-line-error',
      \ '-synctex=1',
      \ '-interaction=nonstopmode',
      \ ]}

let g:vimtex_toc_config = {
      \ 'name' : 'TOC',
      \ 'layers' : ['content', 'todo', 'include'],
      \ 'resize' : 1,
      \ 'split_width' : 30,
      \ 'todo_sorted' : 0,
      \ 'show_help' : 1,
      \ 'show_numbers' : 1,
      \ 'mode' : 2,
      \ }

Thank you very much for your help, I am not very familiar with the configuration of vim. I used your config and now everything is OK

lervag commented 1 year ago

Thank you very much for your help, I am not very familiar with the configuration of vim. I used your config and now everything is OK

Great, happy to help! And glad to hear things are working now.