blob: 615488068a2ba09e1706fa3f07a6400ec5ad5546 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
#compdef zathura
(( $+functions[_zathura_files] )) ||
_zathura_files(){
local -a plugins_files
local plugins_dir
for plugins_dir in \
${(Qv)opt_args[(i)-p|--plugins-dir]}(#qN) \
{/usr/local,/usr,}/lib/zathura(#qN)
do
plugins_files+=( $plugins_dir/*.so(N) )
done
if [[ -z "${plugins_files}" ]]; then
_files -g "*.pdf(-.)"
return
fi
local -a supported_filetypes
local pf
for pf in "${plugins_files[@]}"; do
if [[ $pf =~ "mupdf" ]]; then
supported_filetypes+="pdf"
supported_filetypes+="epub"
supported_filetypes+="xps"
elif [[ $pf =~ "poppler" ]]; then
supported_filetypes+="pdf"
else
supported_filetypes+="${pf:t:r}"
fi
done
_files -g "*.(${(j.|.)${(@u)supported_filetypes}})(-.)"
}
_arguments -s -S \
{-e,--reparent=}'[specify xid of window to reparent to]:xid:_x_window' \
{-c,--config-dir=}'[specify path to the config directory]:config directory:{_files -/}' \
{-d,--data-dir=}'[specify path to the data directory]:data directory:{_files -/}' \
{-p,--plugins-dir=}'[specify path to the directory containing plugins]:plugins directory:{_files -/}' \
{-w,--password=}"[specify a password for the document]:password: " \
{-P,--page=}'[open the document at the given page number]:page number: ' \
{-l,--log-level=}'[set log level]:log level:(debug info warning error)' \
{-x,--synctex-editor-command=}'[specify synctex editor command]:synctex editor command:_cmdstring' \
'--synctex-forward=[jump to the given position]:synctex position: ' \
'--synctex-pid=[specify pid of an instance having the correct file opened]:synctex pid:_pids' \
'--fork[fork into background]' \
'(- :)--version[display version string and exit]' \
'(- :)--help[display help and exit]' \
'*:file:_zathura_files'
|