.m files as MATLAB/Octave for Sublime Text

scharfmn picture scharfmn · Aug 22, 2012 · Viewed 39.5k times · Source

Sublime sees .m files as Objective C files.

I've been given a bunch of MATLAB/Octave files to work with using Octave, all with .m extensions.

If I change the extensions to .matlab, then Sublime will recognize them and format them correctly, but then Octave doesn't see them.

I would like to either:

(1) alter Sublime so that it recognizes .m as MATLAB/Octave instead of Objective C, or

(2) tell Octave to recognize .matlab as something it can just run.

I've poked around on the Sublime and Octave sides of this, but to no avail (this is not the answer), and I'm an Octave noob. Thank you.

Answer

Eric Leschinski picture Eric Leschinski · Aug 22, 2012

Sublime 2 can be configured to associate certain file extensions to certain syntax highlighting schemes. See this answer for exactly how to do it https://stackoverflow.com/a/8014142/694184