DEV Community

loading...

Discussion on: Open a file in your editor of choice

Collapse
tedhagos profile image
Ted Hagos

Cool. I usually just do these things on Terminal

open myfile.md  -a Typora  # if I want to open it with Typora and not the default markdown editor
open myfile.adoc -a textmate # if I want to open it in TextMate
open myfile.docx -a pages # if I want to open an MS word in Pages

But this guide is good for doing in the GUI

Collapse
brandelune profile image
Jean-Christophe Helary Author

Yes, doing that from Terminal is is totally possible. It's when you're in Finder that you need to fiddle with the keyboard. Copying a file in Finder and pasting it in Terminal gives you an absolute path, so you can use that in a script where you wait for a path argument, but I find that when I'm on the GUI side it's faster to call a GUI side script with Spotlight (or any other utility launcher that takes a selection as argument).