Skip to content

Commit

Permalink
fix(view): better zathura.get_pid()
Browse files Browse the repository at this point in the history
refer: #1971, #947
  • Loading branch information
lervag committed Mar 14, 2021
1 parent 80ea6fe commit 71c6aa0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions autoload/vimtex/view/zathura.vim
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,13 @@ endfunction
" }}}1
function! s:zathura.get_pid() dict abort " {{{1
" First try to match full output file name
let l:cmd = 'pgrep -nf "zathura.*'
\ . escape(get(self, 'outfile', self.out()), '~\%.') . '"'
let l:outfile = fnamemodify(get(self, 'outfile', self.out()), ':t')
let l:cmd = 'pgrep -nf "^zathura.*' . escape(l:outfile, '~\%.') . '"'
let l:pid = str2nr(system(l:cmd)[:-2])

" Now try to match correct servername as fallback
if empty(l:pid)
let l:cmd = 'pgrep -nf "zathura.+--servername ' . v:servername . '"'
let l:cmd = 'pgrep -nf "^zathura.+--servername ' . v:servername . '"'
let l:pid = str2nr(system(l:cmd)[:-2])
endif

Expand Down

0 comments on commit 71c6aa0

Please sign in to comment.