summaryrefslogtreecommitdiff
path: root/Completion/X/Command
diff options
context:
space:
mode:
authorDoron Behar <doron.behar@gmail.com>2018-07-13 22:52:59 +0300
committerPeter Stephenson <p.w.stephenson@ntlworld.com>2018-07-17 21:48:24 +0100
commit50e272d301a5fc6250afc8670075141966d2fee8 (patch)
treeac85877e1b63f2bc00207ba066f17b63a4e78cfe /Completion/X/Command
parent73a3ad345c6915aff3ead289da36f0dbece28591 (diff)
downloadzsh-50e272d301a5fc6250afc8670075141966d2fee8.tar.gz
zsh-50e272d301a5fc6250afc8670075141966d2fee8.zip
43166: new zathura completion
Diffstat (limited to 'Completion/X/Command')
-rw-r--r--Completion/X/Command/_zathura48
1 files changed, 48 insertions, 0 deletions
diff --git a/Completion/X/Command/_zathura b/Completion/X/Command/_zathura
new file mode 100644
index 000000000..141cadf63
--- /dev/null
+++ b/Completion/X/Command/_zathura
@@ -0,0 +1,48 @@
+#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 )
+ (( $#plugins_files )) && break
+ 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%.so}#${plugins_dir}/lib}"
+ fi
+ done
+ _files -g "*.(${(j.|.)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'