Compare commits

..

4 Commits

Author SHA1 Message Date
Shohei YOSHIDA 7fb495cab5
call completion function directly 2025-12-23 13:17:14 +09:00
Shohei YOSHIDA 779f02a78b
Fix appdirs type
This should be array not associative array. And fix its usage too
to pass it to _files correctly
2025-12-23 13:14:42 +09:00
Shohei YOSHIDA 2cff35a45d
Call completion function explicitly
This avoid pressing tab twice to complete subcommand
2025-12-23 13:12:45 +09:00
Shohei YOSHIDA 64484169e2
Add emacs local variables too 2025-12-23 13:11:59 +09:00
1 changed files with 17 additions and 9 deletions

View File

@ -15,16 +15,16 @@ _xdg-mime_query() {
"*::arg:->args"
case $line[1] in
filetype) _arguments '*: :_files' ;;
default) _arguments '*: :_mime_types' ;;
filetype) _files ;;
default) _mime_types ;;
esac
}
_xdg-mime() {
local line
local -A appdirs=(
local -a appdirs=(
/usr/share/applications
$HOME/.local/share/applications
"$HOME/.local/share/applications"
)
_arguments -C \
@ -38,7 +38,7 @@ _xdg-mime() {
query) _xdg-mime_query ;;
default)
_arguments \
"1:Application:_files -W '$appdirs' -g '*.desktop'" \
"1:Application:_files -W appdirs -g '*.desktop'" \
'2: :_mime_types'
;;
install)
@ -59,4 +59,12 @@ _xdg-mime() {
esac
}
_xdg-mime "$@"
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: filetype=zsh expandtab softtabstop=2 tabstop=2 shiftwidth=2