Skip to content

Difficulty getting Okular inverse search to work #2870

@TryerGit

Description

@TryerGit

Description

On Linux, I am able to get Okular forward search to work fine. I am unable to get backward search to work.

Steps to reproduce

My vimrc is:

let g:vimtex_view_general_viewer = 'okular'
let g:vimtex_view_general_options = '--unique file:@pdf\#src:@line@tex'
if empty(v:servername) && exists('*remote_startserver')
  call remote_startserver('VIM')
endif

if empty(glob('~/.vim/autoload/plug.vim'))
    silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
        \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
    autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
call plug#begin('~/.vim/plugged')
Plug 'lervag/vimtex'
call plug#end()

My main.tex which I call via vim main.tex in a folder containing the .tex file and above .vimrc is:

\documentclass{article}
\begin{document}
Page 1

\newpage
Page 2

\newpage
Page 3
\end{document}

Extra white space in the .tex file is to ensure that backward search actually working. The pdf output spans 3 pages long even without the extra white space.

EDIT by @lervag: The extra white space is not necessary to test backward search and adds unnecessary scrolling when viewing the issue.

Forward search works fine with \lv from within the .tex to the output pdf file, taking me to each of the 3 pages on demand. Inverse search with "Shift + Left Mouse Click" on the Okular pdf file location, however, does not work.

I indeed have set within "Configure Okular dialog box" following https://docs.kde.org/stable5/en/okular/okular/inverse_search.html the setup of "Custom Text Editor" with Command: vim --remote-silent +%l %f

Expected behavior

No response

Actual behavior

No response

Do you use a latexmkrc file?

No.

VimtexInfo

System info:
  OS: Ubuntu 20.04.6 LTS
  Vim version: VIM 9.0 (1-2009)
  Has clientserver: true
  Servername: VIM

VimTeX project: main
  base: main.tex
  root: /home/TryerGit/GoogleDrive/research_programming/Setup Folder/latex/okular_reverse_search
  tex: /home/TryerGit/GoogleDrive/research_programming/Setup Folder/latex/okular_reverse_search/main.tex
  main parser: fallback current file
  document class: 
  compiler: latexmk
    engine: -pdf
    options:
      -verbose
      -file-line-error
      -synctex=1
      -interaction=nonstopmode
    callback: 1
    continuous: 1
    executable: latexmk
    job: 
      jobid: process 6917 run
      output: /tmp/vC8PC7M/0
      cmd: max_print_line=2000 latexmk -verbose -file-line-error -synctex=1 -interaction=nonstopmode -pdf -pvc -view=none -e '$compiling_cmd = ($compiling_cmd ? $compilin
g_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: 6917
  viewer: General
    job: 
      pid: 7185
      cmd: okular --unique file:'/home/TryerGit/GoogleDrive/research_programming/Setup Folder/latex/okular_reverse_search/main.pdf'\#src:86'/home/TryerGit/GoogleDrive/research_programming/Setup Folder/latex/okular_reverse_search/main.tex'
  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