Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Viewer always defaults to evince instead of zathura #2802

Closed
chakravala opened this issue Oct 1, 2023 · 14 comments
Closed

Viewer always defaults to evince instead of zathura #2802

chakravala opened this issue Oct 1, 2023 · 14 comments
Labels

Comments

@chakravala
Copy link

chakravala commented Oct 1, 2023

Description

I always used vimtex with zathura in the past, but now it always defaults to evince instead of zathura and I don't know how to fix it, changing the options doesn't work and I don't know how to troubleshoot this issue. Also I set xdg-open to use zathura and that doesn't seem to make a difference either...

Expected behavior

Zathuara viewer

Actual behavior

Evince viewer

Do you use a latexmkrc file?

Yes

VimtexInfo

1 System info:
  2   OS: Arch Linux
  3   Vim version: VIM 9.0 (1-1882)
  4   Has clientserver: true
  5   Servername: VIM
  6 
  7 VimTeX project: Fourier-Analysis
  8   base: _
  9   root: _
 10   tex: _
 11   main parser: current file verified
 12   document class: article
 13   packages: algorithm algpseudocode alltt amsfonts amsmath amssymb amsthm dirtytalk geometr
 14   source files:
 15     Fourier-Analysis.tex
 16     ../mathdoc.tex
 17     ../mathsym.tex
 18     ../theorem.tex
 19   compiler: latexmk
 20     engine: -lualatex
 21     options:
 22       -verbose
 23       -file-line-error
 24       -synctex=1
 25       -interaction=nonstopmode
 26     callback: 1
 27     continuous: 1
 28     executable: latexmk
 29   viewer: Zathura
 30     xwin id: 0
 31   qf method: LaTeX logfile
@chakravala chakravala added the bug label Oct 1, 2023
@lervag
Copy link
Owner

lervag commented Oct 2, 2023

According to the :VimtexInfo blob, it seems you are using Zathura. Can you explain in more depth what you are doing? What are your VimTeX options?

I want things like this:

  1. Open a terminal
  2. cd some/path
  3. vim file.tex
  4. Start compiler with \ll
  5. Start viewer with \lv

or similar.

@chakravala
Copy link
Author

That's correct, I am using that exact procedure as usual (I have not used vimtex in quite a while though).

When I use \lv it always opens Evince instead of Zathura no matter what I do or how I configure things.

I even tried to change options.vim to replace xdg-open with zathura and that doesn't work either.

@lervag
Copy link
Owner

lervag commented Oct 3, 2023

That's correct, I am using that exact procedure as usual (I have not used vimtex in quite a while though).

When I use \lv it always opens Evince instead of Zathura no matter what I do or how I configure things.

Ok. Obviously I can't reproduce this. Can you explain your Vim and VimTeX configuration?

@chakravala
Copy link
Author

Thanks for your response! I figured out that it's opening a .dvi file instead of .pdf ... do you happen to have any idea why that may be? It seems zathura does not work with dvi but evince is the default viewer for DVI

@lervag
Copy link
Owner

lervag commented Oct 4, 2023

No; Again, can you show me your configuration and setup? VimTeX will always start latexmk (or other compiler backends) to produce pdf's, not dvi, so you are either doing something strange in your config, or you are using some conflicting plugin.

@chakravala
Copy link
Author

chakravala commented Oct 4, 2023

Unfortunately, my SSD died so I lost some of my configurations and I'm trying to figure out my setup again.

My .latexmkrc contains something like

$pdf_previewer = "zathura"; 
$pdflatex = 'lualatex';
$pdf_mode = 4;
$postscript_mode = $dvi_mode = 0;
add_cus_dep( 'nlo', 'nls', 0, 'makenlo2nls' );
sub makenlo2nls {
system( "makeindex -s nomencl.ist -o \"$_[0].nls\" \"$_[0].nlo\"" );
}

Although changing it to this doesn't really make a difference:

$pdf_previewer = "zathura %O %S";
$pdflatex='pdflatex -synctex=1 %O %B';
$pdf_mode = 1;
$postscript_mode = $dvi_mode = 0;

Whatever I put in there doesn't really seem to affect anything as far as I can tell ... it does affect it if I run latexmk manually, so VimTex seems to be doing something different than when I manually run latexmk.

execute pathogen#infect()
call pathogen#helptags()
filetype plugin indent on
syntax on

" auto completion
set wildmode=longest,list,full

" spell checking
map <leader>o :setlocal spell! spelllang=en_US<CR>
map <leader>s :!clear && shellcheck %<CR>

" bibliography
map <leader>b :vsp<space>$BIB<CR>
map <leader>r :vsp<space>$REFER<CR>

set undofile nocompatible number
set completeopt=menuone,longest,preview complete+=k
set linebreak breakindent breakindentopt=shift:2
set tabstop=4 shiftwidth=4
autocmd FileType julia set expandtab softtabstop=4

colo slate
hi Normal guibg=NONE ctermbg=NONE
autocmd FileType tex colorscheme lucius
autocmd FileType tex hi Normal guibg=NONE ctermbg=NONE
autocmd FileType tex hi LineNr guibg=NONE ctermbg=NONE
autocmd FileType tex exec("setlocal dictionary+=".$HOME."/.vim/dictionaries/".expand('<amatch>'))

let g:tex_flavor = 'latex'
let g:vimtex_matchparen_enabled = 0
let g:vimtex_view_method = 'zathura'
"let g:vimtex_view_general_viewer = 'zathura'
"let g:vimtex_view_general_options = '--unique file:@pdf\#src:@line@tex'
"let g:vimtex_view_general_viewer = 'qpdfview'
"let g:vimtex_view_general_options = '--unique @pdf\#src:@tex:@line:@col'
"let g:vimtex_view_general_options_latexmk = '--unique'
"let g:vimtex_view_general_options_latexmk = '-pdflatex=lualatex'
"let g:vimtex_view_general_options = '-pdflatex=lualatex'
"let g:vimtex_compiler_method = 'latexmk'

"let g:vimtex_view_automatic = 0
let g:vimtex_view_forward_search_on_start = 0
let g:vimtex_view_process_start = 0
let g:vimtex_view_xwin_exists = 0

autocmd BufNewFile,BufRead *.wl set syntax=wl
autocmd BufNewFile,BufRead *.wls set syntax=wl
autocmd BufNewFile,BufRead *.m set syntax=wl

autocmd FileType julia hi DiffAdd guifg=NONE ctermfg=NONE guibg=#464632 ctermbg=238 gui=NONE cterm=NONE
autocmd FileType julia hi DiffChange guifg=NONE ctermfg=NONE guibg=#335261 ctermbg=239 gui=NONE cterm=NONE
autocmd FileType julia hi DiffDelete guifg=#f43753 ctermfg=203 guibg=#79313c ctermbg=237 gui=NONE cterm=NONE
autocmd FileType julia hi DiffText guifg=NONE ctermfg=NONE guibg=NONE ctermbg=NONE gui=reverse cterm=reverse

@lervag
Copy link
Owner

lervag commented Oct 4, 2023

Ok. After you open any tex file in Vim, can you do :scriptnames and report the output?

I.e.:

  1. Open a file with vim (e.g. vim test.tex)
  2. Run :scriptnames
  3. Copy the output to a response here

@chakravala
Copy link
Author

  1: /etc/vimrc
  2: /usr/share/vim/vimfiles/archlinux.vim
  3: ~/.vimrc
  4: ~/.vim/autoload/pathogen.vim
  5: /usr/share/vim/vim90/filetype.vim
  6: ~/.vim/bundle/julia-vim/ftdetect/julia.vim
  7: ~/.vim/bundle/lean.vim/ftdetect/lean.vim
  8: ~/.vim/bundle/rust.vim/ftdetect/rust.vim
  9: ~/.vim/bundle/vim-fugitive/ftdetect/fugitive.vim
 10: ~/.vim/bundle/vim-sage/ftdetect/sage.vim
 11: ~/.vim/bundle/vimtex/ftdetect/cls.vim
 12: ~/.vim/bundle/vimtex/ftdetect/tex.vim
 13: ~/.vim/bundle/vimtex/ftdetect/tikz.vim
 14: /usr/share/vim/vimfiles/ftdetect/PKGBUILD.vim
 15: /usr/share/vim/vimfiles/ftdetect/SRCINFO.vim
 16: /usr/share/vim/vimfiles/ftdetect/espeakfiletype.vim
 17: /usr/share/vim/vim90/ftplugin.vim
 18: /usr/share/vim/vim90/indent.vim
 19: /usr/share/vim/vim90/syntax/syntax.vim
 20: /usr/share/vim/vim90/syntax/synload.vim
 21: /usr/share/vim/vim90/syntax/syncolor.vim
 22: /usr/share/vim/vim90/colors/lists/default.vim
 23: /usr/share/vim/vim90/colors/slate.vim
 24: ~/.vim/bundle/rust.vim/plugin/cargo.vim
 25: ~/.vim/bundle/rust.vim/plugin/rust.vim
 26: ~/.vim/bundle/supertab/plugin/supertab.vim
 27: ~/.vim/bundle/syntastic/plugin/syntastic/autoloclist.vim
 28: ~/.vim/bundle/syntastic/plugin/syntastic/balloons.vim
 29: ~/.vim/bundle/syntastic/plugin/syntastic/checker.vim
 30: ~/.vim/bundle/syntastic/plugin/syntastic/cursor.vim
 31: ~/.vim/bundle/syntastic/plugin/syntastic/highlighting.vim
 32: ~/.vim/bundle/syntastic/plugin/syntastic/loclist.vim
 33: ~/.vim/bundle/syntastic/plugin/syntastic/modemap.vim
 34: ~/.vim/bundle/syntastic/plugin/syntastic/notifiers.vim
 35: ~/.vim/bundle/syntastic/plugin/syntastic/registry.vim
 36: ~/.vim/bundle/syntastic/plugin/syntastic/signs.vim
 37: ~/.vim/bundle/syntastic/plugin/syntastic.vim
 38: ~/.vim/bundle/syntastic/autoload/syntastic/util.vim
 39: ~/.vim/bundle/vim-fugitive/plugin/fugitive.vim
 40: ~/.vim/bundle/vimtex/plugin/vimtex.vim
 41: /usr/share/vim/vimfiles/plugin/SyntaxFolds.vim
 42: /usr/share/vim/vimfiles/plugin/filebrowser.vim
 43: /usr/share/vim/vimfiles/plugin/imaps.vim
 44: /usr/share/vim/vimfiles/plugin/remoteOpen.vim
 45: /usr/share/vim/vim90/plugin/getscriptPlugin.vim
 46: /usr/share/vim/vim90/plugin/gzip.vim
 47: /usr/share/vim/vim90/plugin/logiPat.vim
 48: /usr/share/vim/vim90/plugin/manpager.vim
 49: /usr/share/vim/vim90/plugin/matchparen.vim
 50: /usr/share/vim/vim90/plugin/netrwPlugin.vim
 51: /usr/share/vim/vim90/plugin/rrhelper.vim
 52: /usr/share/vim/vim90/plugin/spellfile.vim
 53: /usr/share/vim/vim90/plugin/tarPlugin.vim
 54: /usr/share/vim/vim90/plugin/tohtml.vim
 55: /usr/share/vim/vim90/plugin/vimballPlugin.vim
 56: /usr/share/vim/vim90/plugin/zipPlugin.vim
 57: /usr/share/vim/vim90/autoload/dist/ft.vim
 58: ~/.vim/bundle/julia-vim/autoload/LaTeXtoUnicode.vim
 59: ~/.vim/bundle/julia-vim/autoload/julia_latex_symbols.vim
 60: ~/.vim/bundle/vimtex/ftplugin/tex.vim
 61: ~/.vim/bundle/vimtex/autoload/vimtex.vim
 62: ~/.vim/bundle/vimtex/autoload/vimtex/options.vim
 63: ~/.vim/bundle/vimtex/autoload/vimtex/util.vim
 64: ~/.vim/bundle/vimtex/autoload/vimtex/jobs.vim
 65: ~/.vim/bundle/vimtex/autoload/vimtex/cache.vim
 66: ~/.vim/bundle/vimtex/autoload/vimtex/paths.vim
 67: ~/.vim/bundle/vimtex/autoload/vimtex/state.vim
 68: ~/.vim/bundle/vimtex/autoload/vimtex/re.vim
 69: ~/.vim/bundle/vimtex/autoload/vimtex/parser.vim
 70: ~/.vim/bundle/vimtex/autoload/vimtex/parser/tex.vim
 71: ~/.vim/bundle/vimtex/autoload/vimtex/state/class.vim
 72: ~/.vim/bundle/vimtex/autoload/vimtex/view.vim
 73: ~/.vim/bundle/vimtex/autoload/vimtex/view/zathura.vim
 74: ~/.vim/bundle/vimtex/autoload/vimtex/view/_template.vim
 75: ~/.vim/bundle/vimtex/autoload/vimtex/compiler.vim
 76: ~/.vim/bundle/vimtex/autoload/vimtex/compiler/latexmk.vim
 77: ~/.vim/bundle/vimtex/autoload/vimtex/compiler/_template.vim
 78: ~/.vim/bundle/vimtex/autoload/vimtex/qf.vim
 79: ~/.vim/bundle/vimtex/autoload/vimtex/qf/latexlog.vim
 80: ~/.vim/bundle/vimtex/autoload/vimtex/toc.vim
 81: ~/.vim/bundle/vimtex/autoload/vimtex/fold.vim
 82: ~/.vim/bundle/vimtex/autoload/vimtex/fold/envs.vim
 83: ~/.vim/bundle/vimtex/autoload/vimtex/fold/cmd_single_opt.vim
 84: ~/.vim/bundle/vimtex/autoload/vimtex/fold/markers.vim
 85: ~/.vim/bundle/vimtex/autoload/vimtex/fold/preamble.vim
 86: ~/.vim/bundle/vimtex/autoload/vimtex/fold/sections.vim
 87: ~/.vim/bundle/vimtex/autoload/vimtex/fold/cmd_addplot.vim
 88: ~/.vim/bundle/vimtex/autoload/vimtex/fold/env_options.vim
 89: ~/.vim/bundle/vimtex/autoload/vimtex/fold/cmd_multi.vim
 90: ~/.vim/bundle/vimtex/autoload/vimtex/fold/items.vim
 91: ~/.vim/bundle/vimtex/autoload/vimtex/fold/cmd_single.vim
 92: ~/.vim/bundle/vimtex/autoload/vimtex/context.vim
 93: ~/.vim/bundle/vimtex/autoload/vimtex/context/cite.vim
 94: ~/.vim/bundle/vimtex/autoload/vimtex/parser/fls.vim
 95: ~/.vim/bundle/vimtex/autoload/vimtex/bib.vim
 96: ~/.vim/bundle/vimtex/autoload/vimtex/cmd.vim
 97: ~/.vim/bundle/vimtex/autoload/vimtex/complete.vim
 98: ~/.vim/bundle/vimtex/autoload/vimtex/debug.vim
 99: ~/.vim/bundle/vimtex/autoload/vimtex/delim.vim
100: ~/.vim/bundle/vimtex/autoload/vimtex/doc.vim
101: ~/.vim/bundle/vimtex/autoload/vimtex/env.vim
102: ~/.vim/bundle/vimtex/autoload/vimtex/format.vim
103: ~/.vim/bundle/vimtex/autoload/vimtex/fzf.vim
104: ~/.vim/bundle/vimtex/autoload/vimtex/imaps.vim
105: ~/.vim/bundle/vimtex/autoload/vimtex/include.vim
106: ~/.vim/bundle/vimtex/autoload/vimtex/info.vim
107: ~/.vim/bundle/vimtex/autoload/vimtex/kpsewhich.vim
108: ~/.vim/bundle/vimtex/autoload/vimtex/log.vim
109: ~/.vim/bundle/vimtex/autoload/vimtex/matchparen.vim
110: ~/.vim/bundle/vimtex/autoload/vimtex/misc.vim
111: ~/.vim/bundle/vimtex/autoload/vimtex/motion.vim
112: ~/.vim/bundle/vimtex/autoload/vimtex/nvim.vim
113: ~/.vim/bundle/vimtex/autoload/vimtex/pos.vim
114: ~/.vim/bundle/vimtex/autoload/vimtex/profile.vim
115: ~/.vim/bundle/vimtex/autoload/vimtex/scratch.vim
116: ~/.vim/bundle/vimtex/autoload/vimtex/syntax.vim
117: ~/.vim/bundle/vimtex/autoload/vimtex/text_obj.vim
118: ~/.vim/bundle/vimtex/autoload/vimtex/ui.vim
119: ~/.vim/bundle/vimtex/autoload/vimtex/text_obj/targets.vim
120: /usr/share/vim/vimfiles/ftplugin/tex_latexSuite.vim
121: /usr/share/vim/vimfiles/ftplugin/latex-suite/main.vim
122: /usr/share/vim/vimfiles/ftplugin/latex-suite/texrc
123: /usr/share/vim/vimfiles/ftplugin/latex-suite/texproject.vim
124: /usr/share/vim/vimfiles/ftplugin/latex-suite/texmenuconf.vim
125: /usr/share/vim/vimfiles/ftplugin/latex-suite/envmacros.vim
126: /usr/share/vim/vimfiles/ftplugin/latex-suite/wizardfuncs.vim
127: /usr/share/vim/vimfiles/ftplugin/latex-suite/elementmacros.vim
128: /usr/share/vim/vimfiles/ftplugin/latex-suite/mathmacros.vim
129: /usr/share/vim/vimfiles/ftplugin/latex-suite/multicompile.vim
130: /usr/share/vim/vimfiles/ftplugin/latex-suite/compiler.vim
131: /usr/share/vim/vimfiles/ftplugin/latex-suite/folding.vim
132: /usr/share/vim/vimfiles/ftplugin/latex-suite/templates.vim
133: /usr/share/vim/vimfiles/ftplugin/latex-suite/custommacros.vim
134: /usr/share/vim/vimfiles/ftplugin/latex-suite/bibtex.vim
135: /usr/share/vim/vimfiles/ftplugin/latex-suite/brackets.vim
136: /usr/share/vim/vimfiles/ftplugin/latex-suite/smartspace.vim
137: /usr/share/vim/vimfiles/ftplugin/latex-suite/texviewer.vim
138: /usr/share/vim/vimfiles/ftplugin/latex-suite/version.vim
139: /usr/share/vim/vimfiles/ftplugin/latex-suite/packages.vim
140: /usr/share/vim/vimfiles/compiler/tex.vim
141: /usr/share/vim/vim90/ftplugin/tex.vim
142: ~/.vim/bundle/vimtex/after/ftplugin/tex.vim
143: ~/.vim/bundle/vimtex/indent/tex.vim
144: /usr/share/vim/vimfiles/indent/tex.vim
145: /usr/share/vim/vim90/indent/tex.vim
146: ~/.vim/bundle/vimtex/syntax/tex.vim
147: ~/.vim/bundle/vimtex/autoload/vimtex/syntax/core.vim
148: ~/.vim/bundle/vimtex/autoload/vimtex/syntax/nested.vim
149: ~/.vim/bundle/vimtex/autoload/vimtex/syntax/packages.vim
150: ~/.vim/bundle/vimtex/autoload/vimtex/syntax/p/amsmath.vim
151: /usr/share/vim/vim90/syntax/tex.vim
152: /usr/share/vim/vimfiles/colors/lucius.vim
153: ~/.vim/bundle/syntastic/autoload/syntastic/log.vim

@lervag
Copy link
Owner

lervag commented Oct 4, 2023

Cool, notice this:

120: /usr/share/vim/vimfiles/ftplugin/tex_latexSuite.vim
121: /usr/share/vim/vimfiles/ftplugin/latex-suite/main.vim
122: /usr/share/vim/vimfiles/ftplugin/latex-suite/texrc
123: /usr/share/vim/vimfiles/ftplugin/latex-suite/texproject.vim
124: /usr/share/vim/vimfiles/ftplugin/latex-suite/texmenuconf.vim
125: /usr/share/vim/vimfiles/ftplugin/latex-suite/envmacros.vim
126: /usr/share/vim/vimfiles/ftplugin/latex-suite/wizardfuncs.vim
127: /usr/share/vim/vimfiles/ftplugin/latex-suite/elementmacros.vim
128: /usr/share/vim/vimfiles/ftplugin/latex-suite/mathmacros.vim
129: /usr/share/vim/vimfiles/ftplugin/latex-suite/multicompile.vim
130: /usr/share/vim/vimfiles/ftplugin/latex-suite/compiler.vim
131: /usr/share/vim/vimfiles/ftplugin/latex-suite/folding.vim
132: /usr/share/vim/vimfiles/ftplugin/latex-suite/templates.vim
133: /usr/share/vim/vimfiles/ftplugin/latex-suite/custommacros.vim
134: /usr/share/vim/vimfiles/ftplugin/latex-suite/bibtex.vim
135: /usr/share/vim/vimfiles/ftplugin/latex-suite/brackets.vim
136: /usr/share/vim/vimfiles/ftplugin/latex-suite/smartspace.vim
137: /usr/share/vim/vimfiles/ftplugin/latex-suite/texviewer.vim
138: /usr/share/vim/vimfiles/ftplugin/latex-suite/version.vim
139: /usr/share/vim/vimfiles/ftplugin/latex-suite/packages.vim

You have installed LaTeX-Suite, which is a different LaTeX plugin for Vim. This explains your problems, most likely.

Learning point: NEVER install Vim plugins through your regular linux package manager!

Now, some additional comments:

My .latexmkrc contains something like …

VimTeX should typically respect your latexmkrc file, and I don't see any immediate problems here.

Your Vim configuration looks fine, although I would recommend some things:

  1. Use a plugin manager, e.g. vim-plug. It makes it much easier to quickly test and try new plugins. Still, pathogen is also fine and should work well if you know what you are doing.

  2. g:tex_flavor is not relevant when you use VimTeX, so just remove it.

  3. g:vimtex_view_process_start and g:vimtex_view_xwin_exists are not valid options.

  4. I would advice to gather all filetype specific adjustments to a dedicated section.

  5. I would advice to avoid setting multiple options on a single line - it makes it harder to read.

Thus, you could simplify and improve your configuration to this:

execute pathogen#infect()
call pathogen#helptags()
filetype plugin indent on
syntax on

set wildmode=longest,list,full
set undofile
set nocompatible
set number
set complete+=k
set completeopt=menuone,longest,preview
set linebreak
set breakindent
set breakindentopt=shift:2
set tabstop=4
set shiftwidth=4

colorscheme slate
highlight Normal guibg=NONE ctermbg=NONE

map <leader>o :setlocal spell! spelllang=en_US<CR>
map <leader>s :!clear && shellcheck %<CR>

map <leader>b :vsp<space>$BIB<CR>
map <leader>r :vsp<space>$REFER<CR>

let g:vimtex_matchparen_enabled = 0
let g:vimtex_view_method = 'zathura'
let g:vimtex_view_forward_search_on_start = 0

autocmd BufNewFile,BufRead *.wl set syntax=wl
autocmd BufNewFile,BufRead *.wls set syntax=wl
autocmd BufNewFile,BufRead *.m set syntax=wl

autocmd FileType tex colorscheme lucius
autocmd FileType tex hi Normal guibg=NONE ctermbg=NONE
autocmd FileType tex hi LineNr guibg=NONE ctermbg=NONE
autocmd FileType tex exec("setlocal dictionary+=".$HOME."/.vim/dictionaries/".expand('<amatch>'))

autocmd FileType julia set expandtab softtabstop=4
autocmd FileType julia hi DiffAdd guifg=NONE ctermfg=NONE guibg=#464632 ctermbg=238 gui=NONE cterm=NONE
autocmd FileType julia hi DiffChange guifg=NONE ctermfg=NONE guibg=#335261 ctermbg=239 gui=NONE cterm=NONE
autocmd FileType julia hi DiffDelete guifg=#f43753 ctermfg=203 guibg=#79313c ctermbg=237 gui=NONE cterm=NONE
autocmd FileType julia hi DiffText guifg=NONE ctermfg=NONE guibg=NONE ctermbg=NONE gui=reverse cterm=reverse

@lervag lervag closed this as completed Oct 4, 2023
@chakravala
Copy link
Author

Thank you so much, removing vim-latexsuite fixed it for me, this had me really confused after re-installing my system.

@lervag
Copy link
Owner

lervag commented Oct 4, 2023

Yes, I am not surprised that this was confusing. It is one of the main reasons I strongly urge that noone ever uses Vim plugins through system package managers.

In any case, I'm glad to hear this works for you now and I hope you find VimTeX to be a pleasant experience. :)

@chakravala
Copy link
Author

One issue I had in the past is that I had to have a custom autoload/vimtex/view/my_zathura.vim file containing

  if g:vimtex_view_automatic
    "
    " Search for existing window created by latexmk
    "   It may be necessary to wait some time before it is opened and
    "   recognized. Sometimes it is very quick, other times it may take
    "   a second. This way, we don't block longer than necessary.
    "
    if !has_key(self, 'started_through_callback') && g:vimtex_view_xwin_exists
      for l:dummy in range(30)
        sleep 50m
        if self.xwin_exists() | break | endif
      endfor
    endif

Specifically, I changed 500m to 50m, as half a second was simply too sluggish for me.

However, I see that VimTex has changed since then, so I no longer know if I need to apply this fix in some other way.

And oh yes, VimTex is my favorite environment for LaTeX, I would not want to use anything else!

@chakravala
Copy link
Author

Is this the line of code I need to change to 50m to make a similar change as I did in the past:

So I need to somehow create another custom file for that? Or could this become an official option to change the sleep timer?

@lervag
Copy link
Owner

lervag commented Oct 5, 2023

One issue I had in the past is that I had to have a custom autoload/vimtex/view/my_zathura.vim file containing …

Specifically, I changed 500m to 50m, as half a second was simply too sluggish for me.

Is this the line of code I need to change to 50m to make a similar change as I did in the past:

Yes, that seems right. The reason for adding this delay is that a regular system needs some time to start the viewer and xdotool won't find the ID if we don't way.

But I realize that it would be much better to start a timer here instead of sleeping. That would remove the sleep altogether.

I don't have time to fix that immediately, so I suggest the following:

  1. Can you temporarily just adjust the sleep time on your side if you feel the need to?
  2. Can you open a new issue with a short description, a link to this thread, and a suggestion to use timer_start instead of sleep?

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants