Skip to content

Commit

Permalink
feat: add zathura_simple viewer
Browse files Browse the repository at this point in the history
This is a simpler version of the Zathura viewer that does not depend on
xdotool. It should work better on systems that do not use Xorg, e.g. on
Wayland.

refer: #2046
  • Loading branch information
lervag committed Feb 28, 2023
1 parent 2474ab8 commit 0c01137
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 6 deletions.
2 changes: 1 addition & 1 deletion autoload/vimtex/view/zathura.vim
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function! vimtex#view#zathura#cmdline(outfile, synctex, start) abort " {{{1
endif
endif

if a:synctex && (!(a:start == 1) || g:vimtex_view_forward_search_on_start)
if a:synctex && (a:start != 1 || g:vimtex_view_forward_search_on_start)
let l:cmd .= printf(
\ ' --synctex-forward %d:%d:%s',
\ line('.'), col('.'),
Expand Down
31 changes: 31 additions & 0 deletions autoload/vimtex/view/zathura_simple.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
" VimTeX - LaTeX plugin for Vim
"
" Maintainer: Karl Yngve Lervåg
" Email: karl.yngve@gmail.com
"

function! vimtex#view#zathura_simple#new() abort " {{{1
return s:viewer.init()
endfunction

" }}}1


let s:viewer = vimtex#view#_template#new({
\ 'name': 'Zathura',
\ 'has_synctex': 1,
\})

function! s:viewer._check() dict abort " {{{1
return vimtex#view#zathura#check(self)
endfunction

" }}}1
function! s:viewer._start(outfile) dict abort " {{{1
let self.cmd_start
\ = vimtex#view#zathura#cmdline(a:outfile, self.has_synctex, 2)

call vimtex#jobs#run(self.cmd_start)
endfunction

" }}}1
23 changes: 18 additions & 5 deletions doc/vimtex.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3070,9 +3070,10 @@ OPTIONS *vimtex-options*

Possible values:
* `'general'`
* `'mupdf'` |vimtex-view-mupdf|
* `'skim'` |vimtex-view-skim|
* `'zathura'` |vimtex-view-zathura|
* `'mupdf'` |vimtex-view-mupdf|
* `'skim'` |vimtex-view-skim|
* `'zathura'` |vimtex-view-zathura|
* `'zathura_simple'` |vimtex-view-zathura-simple|

See |vimtex-view-configuration| for more information on various popular
viewers and on how to configure them.
Expand All @@ -3092,8 +3093,10 @@ OPTIONS *vimtex-options*

*g:vimtex_view_mupdf_options*
*g:vimtex_view_zathura_options*
Set options for mupdf (|vimtex-view-mupdf|) and Zathura
(|vimtex-view-zathura|), respectively.
Set options for mupdf and Zathura, respectively. See also:
* |vimtex-view-mupdf|
* |vimtex-view-zathura|
* |vimtex-view-zathura-simple|

Default value: ''

Expand Down Expand Up @@ -5626,6 +5629,16 @@ Note: Viewer handling uses window title matching. If there exists another pdf
might be conflicts. In particular, this might affect forward/inverse
searching for Zathura.

*vimtex-view-zathura-simple*
Zathura (simple) ~
This is a simpler implementation of the Zathura viewer; the user should first
read the docs for |vimtex-view-zathura|.

This variant does not rely on `xdotool`. It leads to a much simpler version
that should work well in most cases. However, `xdotool` is useful in order to
prevent duplicate windows and to detect existing viewer windows when you start
a VimTeX session.

------------------------------------------------------------------------------
SYNCTEX SUPPORT *vimtex-synctex*

Expand Down

0 comments on commit 0c01137

Please sign in to comment.