For those who know me, it's no secret that I'm a Vim man. You know how some people are fish out of water without Visual Studio or (insert IDE here)? I'm a fish out of water without my .vimrc. Thanks to Vim's superior editing capabilities, I can get work done on any computer I need to as long as it at least has a basic Vim installation on it, but when I can use my own macros and settings, let the good times roll.
The other day I decided that since I'm also a Mac man, I ought to start wrapping my head around Objective-C. So I got a book and started in. I quickly discovered that for some reason, Vim wasn't detecting the .m filetype extension for my Objective-C source files. So I did some digging around through the Vim documentation and found the following:
You need in your home directory (or whatever your $VIMRUNTIME directory is) a directory named ".vim". Inside this directory you'll need to make a file called "filetype.vim". Paste the following into that file:
What happens, or at least what happened to me, is that for some reason Vim didn't automagically detect the ".m", or it was conflicting with another filetype for some reason. What the above snippet of vimscript does is ask Vim if it loaded a filetype. In my case, it hadn't. So it skips the "finish" command and moves to the "augroup" section, checking the file extension you gave the file (in this case ".m" and says, "oh hey, that's an Objective-C file", and then sets the filetype as such.
Now I know that some of you may start yelling at me telling me that this is already there on Vim's documentation, blah blah blah. I posted this as a convenience for those who don't want to spend hours digging for it.