Skip to content

[SOLVED] Focus the terminal when doing inverse search #2971

@DaitiDay

Description

@DaitiDay

Description

As for the title, inverse search works fine (I'm using sioyek). The cursor gets put to the correct location in vim, but the terminal does not get focused. Following the suggestion in #2579 I've tried to add the following autocommand to my neovim config:

local group = vim.api.nvim_create_augroup('vimtex', { clear = true })
vim.api.nvim_create_autocmd('VimtexEventViewReverse', { command = "call b:vimtex.viewer.xdo_focus_vim()", group = group })

with no success. Anyone can help me pointing out what I'm doing wrong?

Steps to reproduce

Not relevant.

Expected behavior

Clicking on text in sioyek should switch focus to the terminal and put the cursor on the correct line in the tex file.

Actual behavior

The cursor gets put on the correct line in the tex file but the terminal does not get focus.

Do you use a latexmkrc file?

no

VimtexInfo

System info:
  OS: Linux 6.9.3-arch1-1
  Vim version: NVIM v0.10.0
  Has clientserver: true
  Servername: /run/user/1000/nvim.1820.0

VimTeX project: main
  base: main.tex
  root: /home/daiti/tmp
  tex: /home/daiti/tmp/main.tex
  main parser: current file verified
  document class: article
  packages: expl3 l3keys2e lipsum
  compiler: latexmk
    engine: -pdf
    options:
      -verbose
      -file-line-error
      -synctex=1
      -interaction=nonstopmode
    aux_dir: ./build
    callback: 1
    continuous: 1
    executable: latexmk
    job: 
      jobid: 6
      output: /tmp/nvim.daiti/2IMbsC/0
      cmd: max_print_line=2000 latexmk -verbose -file-line-error -synctex=1 -interaction=nonstopmode  -pdf -emulate-aux-dir -auxdir=./build -pvc -pvctimeout- -view=none -e '$compiling_cmd = ($compiling_cmd ? $compiling_cmd . " ; " : "") . "echo vimtex_compiler_callback_compiling"' -e '$success_cmd = ($success_cmd ? $success_cmd . " ; " : "") . "echo vimtex_compiler_callback_success"' -e '$failure_cmd = ($failure_cmd ? $failure_cmd . " ; " : "") . "echo vimtex_compiler_callback_failure"' 'main.tex'
      pid: 2015
  viewer: sioyek
    job: 
      pid: 2027
      cmd: sioyek  --inverse-search "/usr/bin/nvim --headless -c \"VimtexInverseSearch %2 '%1'\"" --forward-search-file '/home/daiti/tmp/main.tex' --forward-search-line 1 '/home/daiti/tmp/main.pdf'
    cmd_start: sioyek  --inverse-search "/usr/bin/nvim --headless -c \"VimtexInverseSearch %2 '%1'\"" --forward-search-file '/home/daiti/tmp/main.tex' --forward-search-line 1 '/home/daiti/tmp/main.pdf'
  qf method: LaTeX logfile

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions