ohmyzsh: can't use tab-completion with Yoink Mac app
encounter the same problem as this
attached omz-debug log. gist file. please help.
Transcription from the above link:
I’m running a zsh terminal under Yosemite and have defined a simple alias to place files in Yoink:
$ alias yoink='open -a Yoink'
$ yoink my-file-to-yoink.txt
This works great but for some unknown reason the tab completion to specify the file does not work after yoink. It simple says -- no matches found --.
Is there a way I can use tab completing in combination with this alias?
Thanks.
ps: Not sure if it’s related, but I’m using zprezto.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 23 (12 by maintainers)
Hi. Thank you for the heads-up on this, I wasn’t aware of this issue at all. I’ll fix the Info.plist with the next update, it should be out some time next week.
Thanks again!
Yes.
open -a Yoink <file>adds it to the Yoink staging area, just like it had been drag-and-dropped there. Given that behavior, I would think they want to declare'*'as a handled extension type inCFBundleTypeExtensions, or something similar.TL;DR
I can reproduce. I don’t think this is OMZ. The
_openfunction (provided byzshitself) is working normally, but Yoink.app’s metadata doesn’t declare it handles any input file types, so_opendoesn’t think there are any valid file candidates for completion. Try reporting this to the Yoink developers, or write a custom_yoinkfunction.Details
I can reproduce this. Without Yoink installed, completing
open -a Yoink ...will list a bunch of files as possible completions. But with Yoink 3.2 installed, completingopen -a Yoink ...offers zero files. I also get the same behavior if I turn off Oh My Zsh, but still runcompinitas part of myzshstartup.This may be a file type and application metadata thing. When doing
open -a Foo ...,_openwill only list files whose extensions are valid for the particular application you’re completing against. This is done by calling the_mac_files_for_applicationfunction.Here’s that function’s logic. It looks into the installed application’s
Info.plistto see what file types it declares that it handles.And here’s the logic for parsing that info plist.
Solution
I took a look in Yoink.app’s
Contents/Info.plistfile. It does not contain eitherCFBundleTypeExtensionsorCFBundleTypeOSTypeselements. Basically, I think that means it’s not declaring any types of files that it handles as inputs. So_opendoesn’t think there any files that are valid for completion candidates.I think this means that
_openis acting as designed, and the Yoink app’s metadata is interacting with it in an inconvenient way. If Yoink.app really was designed to take any files as input from the command line oropeninvocation, it should probably declare them in itsInfo.plist. You may want to contact the Yoink developers about this to see if they can adjust theInfo.plist, if this is a supported behavior for Yoink.You could also fix this yourself be writing a custom
_yoinkfunction and getting that on your$FPATHfor Zsh’s completion to use. To get this to work, you will need to replace youryoinkalias with ayoink()function that does the same things: completion “looks inside” aliases, but not inside functions, and like Marc said, you don’t want to turn onsetopt complete_aliases.Prezto and OMZ are alternative frameworks to do the same shell configuration work. Running both of them could have unforeseen interactions and breakage, and is not supported. But I don’t think that’s relevant here.