0

I desperately want to open a new instance of MacVim by clicking on its icon in the dock such that it opens a wildcard list of files from my OneDrive directory.

One tip was to use Automator to run a bash shell script, with something like:

open -a MacVim.app -n --args --cmd "cd $HOME/OneDrive/Notes" journal-*

The problem with this approach is that the shell translates "*" in the context of open's current working directory. However, if I try :

cd $HOME/OneDrive/Notes  &&  open -a MacVim.app -n --args --cmd "cd $HOME/OneDrive/Notes" journal-*

this also fails to work as expected. The filenames are expanded properly, but open switches back to the home directory when launching MacVim, so that it tries to open the filenames in the home directory. This seems to run in contradiction to the manual page which states that the app inherits all the environmental settings. Apparently it doesn't really mean that.

What is trivial in Linux and Windows seems monumentally challenging in OSX. Surely there is a simple solution here?

Yet another solution involves xargs and find, but the versions in MacOS are rather archaic (by GNU/Linux standards).

1 Answer 1

0

I haven't tried doing this with Automator (I use Platypus when I want to make a custom script into an "app" and launch it via the Dock, etc.) and I'm an XEmacs guy :-). But, looking at your command, would this work?

open -a MacVim.app -n --args $HOME/OneDrive/Notes/journal-*

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.