>> I'm using vim 7.1 and for some reason when I open something.javascript
>>  vim detects it correctly that it is a javascript file and applies the
>> necessary highlighting but when the same file is renamed to
>> something.js vim doesn't detect it automatically. If I say
>>
>> :filet detect
>>
>> the highlighting is applied correctly. With any other filetype (C,
>> python, etc) automatic highlighting works, I only have to say it
>> manually (:filet detect) for .js files. Why is this?
>>
>> There are these lines in  /usr/share/vim/vim71/filetype.vim
>>
>> " JavaScript, ECMAScript
>> au BufNewFile,BufRead *.js,*.javascript,*.es    setf javascript
>>
>> which would make me think that both file extensions are wired up to be
>> detected as javascript. And I have in my ~/.vimrc
>>
>> filetype plugin on
>> syntax on
>>
>> And nothing js or javascript related in the same file. Does anyone
>> have an idea what's going on?
>
> Does Vim detect something else for *.js files?
>     :e myfile.js
>     :set ft?

Actually, vim thinks it's a C file (using the method you suggested :set ft).

>     :verb au * *.js
> especially
>     :verb au filetypedetect * *.js

Thanks! These suggestion were very useful, they showed that I have a
~/.vim/filetype.vim file which assigned C to *.js (I probably did it
myself about 5+ years ago, last time I remember messing around with my
vim config files).

> In your 'runtimepath', there might be other filetype.vim scripts or
> ftdetect/*.vim files overwriting expected settings.
> Also check
>     :scriptnames

Thanks a lot, I removed the offending lines from ~/.vim/filetype.vim
and now everything is okay.

Cheers,
Daniel

-- 
Psss, psss, put it down! - http://www.cafepress.com/putitdown

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to