I want to open all of my html/css/js etc. not in the Browser by typing open example.html, but with my default Editor. I did create the alias EDITOR already, but it does not work with every kind of file.
How to fix that?
Depending on the actual behavior you're looking for, you will probably want one of the following, from the open man page:
-e Causes the file to be opened with /Applications/TextEdit
-t Causes the file to be opened with the default text editor, as deter-
mined via LaunchServices
-f Reads input from standard input and opens the results in the default
text editor. End input by sending EOF character (type Control-D).
Also useful for piping output to open and having it open in the
default text editor.
-W Causes open to wait until the applications it opens (or that were
already open) have exited. Use with the -n flag to allow open to
function as an appropriate app for the $EDITOR environment variable.
Try reading the man page: man open
I see three options:
-a
-a application
Specifies the application to use for opening the file
open -a SomeEditor file.html
-e
Causes the file to be opened with /Applications/TextEdit
open -e file.html
-t
Causes the file to be opened with the default text editor, as determined via LaunchServices
open -t file.html
If you use TextMate or Sublime Text, you can use mate or subl. You can create aliases like this for other editors:
alias wrang="open -a TextWrangler"
open -t opens files in the default application for public.plain-text files. You can change it by adding a line like this to a duti configuration file:
com.macromates.TextMate.preview public.plain-text all
alias s=open -a Sublimetext. That is what I really needed.
alias, it should beexport.EDITORis an environment variable.opendoesn't useEDITORto choose the editor to open (we're talking about OS X, right? I added that tag).