How to (re-)Associate .h files with Objective-C


#1

I would like all .h files to open with the Objective-C file type instead of the C file type.

I have tried adding this to the config.cson, but to no avail:

'file-types':
    '.h$': 'source.objc'

(I’ve also tried removing the dollar sign, moving it to init.coffee and other things…)

I imagine that the answer lies in the file-types package, which I’ve installed, or perhaps in this exciting chronicle, but beyond that I’m just guessing as to what to change and how.

Thanks!


#2

Do you have File Types installed? If so, keep in mind that you have to put all file-types under the '*' key, as indicated here.


#3

Atom has this capability built-in now. See the FAQ:


#4

Thank you, I tried putting

core:
  customFileTypes:
    "source.objc": ["h"]

in the config.cson, but (perhaps since it’s a file type that’s already associated) it didn’t take. Not sure what to try next.


#5

Thanks! That worked as

  'file-types':
    'h': 'source.objc'

under the "*": in the config.cson.