Closed chakravala closed 11 months ago
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:
cd some/path
vim file.tex
\ll
\lv
or similar.
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.
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?
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
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.
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
Ok. After you open any tex file in Vim, can you do :scriptnames
and report the output?
I.e.:
vim test.tex
):scriptnames
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
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:
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.
g:tex_flavor
is not relevant when you use VimTeX, so just remove it.
g:vimtex_view_process_start
and g:vimtex_view_xwin_exists
are not valid options.
I would advice to gather all filetype specific adjustments to a dedicated section.
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
Thank you so much, removing vim-latexsuite
fixed it for me, this had me really confused after re-installing my system.
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. :)
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!
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?
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:
timer_start
instead of sleep
?Thanks!
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