Skip to content

Backward search doesn't work on neovim + Skim #2157

@AlexFreik

Description

@AlexFreik

Description

My ~/.latexmkrc':

$pdflatex = 'pdflatex -synctex=1';

My ~/.config/nvim/init.vim (checked that the shortened version below still reproduces the problem):

call plug#begin('~/vim/plugged')
Plug 'lervag/vimtex'
    let g:vimtex_view_method='skim'
    let g:vimtex_view_skim_activate=1
    let g:vimtex_view_skim_reading_bar=1
call plug#end()

function! SetServerName()
  if has('win32')
    let nvim_server_file = $TEMP . "/curnvimserver.txt"
  else
    let nvim_server_file = "/tmp/curnvimserver.txt"
  endif
  let cmd = printf("echo %s > %s", v:servername, nvim_server_file)
  call system(cmd)
endfunction

augroup vimtex_common
    autocmd!
    autocmd FileType tex call SetServerName()
augroup END

How I fixed the problem

However, backward search works when using the solution from this article.

TL;DR:

  1. Add the following setting to nvim config.

    function! SetServerName()
      if has('win32')
        let nvim_server_file = $TEMP . "/curnvimserver.txt"
      else
        let nvim_server_file = "/tmp/curnvimserver.txt"
      endif
      let cmd = printf("echo %s > %s", v:servername, nvim_server_file)
      call system(cmd)
    endfunction
    
    augroup vimtex_common
        autocmd!
        autocmd FileType tex call SetServerName()
    augroup END
  2. In the Skim Preferences menu, select "Sync > Custom" and set

    Args: --servername `cat /tmp/curnvimserver.txt` +"%line" "%file"

    (instead of Args: --remote +"%line" "%file")

Steps to reproduce

  1. Follow the instructions from :help vimtex-faq-skimviewer
  2. Try to use Backward search (with Shift-Cmd-Click)

Expected behavior

Backward search

Actual behavior

nothing

Do you use a latexmkrc file?

Yes

VimtexInfo

System info
  OS: macOS 11.4 (20F71)
  Vim version: NVIM v0.6.0-dev+170-gdb1b0ee3b
  Has clientserver: true
  Servername: /var/folders/b6/2r1sc5kn7rz3mb9kqv9439gr0000gn/T/nvim79CnEo/0

VimTeX project: homework1_answersheet
  base: homework1_answersheet.tex
  root: /Users/alexfreik/Documents/GitHub/TUD-CSE/hw1
  tex: /Users/alexfreik/Documents/GitHub/TUD-CSE/hw1/homework1_answersheet.tex
  out: /Users/alexfreik/Documents/GitHub/TUD-CSE/hw1/homework1_answersheet.pdf
  log: /Users/alexfreik/Documents/GitHub/TUD-CSE/hw1/homework1_answersheet.log
  aux: /Users/alexfreik/Documents/GitHub/TUD-CSE/hw1/homework1_answersheet.aux
  fls: /Users/alexfreik/Documents/GitHub/TUD-CSE/hw1/homework1_answersheet.fls
  main parser: current file verified
  source files:
    homework1_answersheet.tex
    header.tex
  compiler: latexmk
    configuration: 
      continuous: 1
      callback: 1
      latexmk options:
        -verbose
        -file-line-error
        -synctex=1
        -interaction=nonstopmode
      latexmk engine: -pdf
    job: 3
    pid: 26882
    cmd: max_print_line=2000 latexmk -verbose -file-line-error -synctex=1 -interaction=nonstopmode -pdf -pvc -view=none -e '$success_cmd = ($success_cmd ? $success_cmd . " ; " : "") . "echo vimtex_compiler_callback_success"' -e '$failure_cmd = ($failure_cmd ? $failure_cmd . " ; " : "") . "echo vimtex_compiler_callback_failure"' 'homework1_answersheet.tex'
  viewer: Skim
    process: 
      pid: -
      cmd: osascript -e 'set theFile to POSIX file "/Users/alexfreik/Documents/GitHub/TUD-CSE/hw1/homework1_answersheet.pdf"' -e 'set thePath to POSIX path of (theFile as alias)' -e 'tell application "Skim"' -e 'try' -e 'set theDocs to get documents whose path is thePath' -e 'if (count of theDocs) > 0 then revert theDocs' -e 'end try' -e 'open theFile' -e 'end tell' >/dev/null 2>&1 &
  qf: LaTeX logfile
  document class: exam
  packages: amsbsy amsfonts amsgen amsmath amsopn amssymb amstext amsthm array atbegshi atbegshi-ltx atveryend atveryend-ltx auxhook babel bigintcalc bitset booktabs color datetime datetime-defaults enumerate epstopdf-base etexcmds etoolbox fcnumparser fcprefix fmtcount gettitlestring graphics graphicx hycolor hyperref iftex ifthen infwarerr intcalc keyval kvdefinekeys kvoptions kvsetkeys letltxmacro ltxcmds mathabx mathdots mathrsfs nameref pdfescape pdftexcmds pgf pgfcomp-version-0-65 pgfcomp-version-1-18 pgfcore pgffor pgfkeys pgfmath pgfplots pgfrcs pgfsys refcount rerunfilecheck tabularx tikz trig uniquecounter url xcolor xkeyval

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions