b4winckler / vim-objc

My Objective-C config for Vim
77 stars 6 forks source link

does not work for new file #3

Closed nn1900 closed 10 years ago

nn1900 commented 10 years ago

When I use "vim filename.m" to create a new file for edit, there's no syntax color highlighting. It only works for editing existing file. I have also tried c/c++ source files, and that worked fine for me. Is this a bug or?

my vimrc file looks as below:

execute pathogen#infect() set nocompatible filetype on filetype plugin indent on syntax on

" tab space settings set autoindent set smartindent set tabstop=4 set shiftwidth=4 set expandtab set number

keith commented 10 years ago

Is vim correctly detecting *.m files as Objective-C? What's the output of set ft? You may need to add something like:

autocmd BufNewFile,BufRead *.h,*.m,*.pch setlocal filetype=objc

To your vimrc

nn1900 commented 10 years ago

@Keithbsmiley that works for me. thanks a lot.

b4winckler commented 10 years ago

Yeah, I think Vim defaults to associating .m files with Matlab...