up vote 0 down vote favorite
share [g+] share [fb]

My vimrc is up here, I am using the same vimrc on two seperate computers, both macs (MacVim). One detects the filetype correctly when launching a file from the terminal. The other makes me manually type.

:set filetype=php

Any other curious observations of my vimrc would be appreciated

link|improve this question
By the way, it doesnt matter which filetype I need. The same thing happens for any file. – joe-bbb Nov 9 '09 at 22:43
I take it you've solved the problem by upgrading MacVim? – Joseph Holsten Nov 10 '09 at 15:38
feedback

migrated from stackoverflow.com Nov 9 '09 at 23:16

This question came from our site for professional and enthusiast programmers.

3 Answers

First thing I would check - On the broken machine, edit your vimrc and make sure set filetype on is in there somewhere.

Other things to check on the broken machine:

  1. $VIMRUNTIME/filetype.vim exists
  2. What does :filetype display when your are editing a file? (Should say that detection plugin & indent are all ON)
  3. Does set syntax off appear in your vimrc anywhere?

A few things from looking at your file:

Lines 70-72:

The file types are also used for syntax highlighting. If the ":syntax on" command is used, the file type detection is installed too. There is no need to do ":filetype on" after ":syntax on".

If you are going to use filetype plugin indent on, then you don't need filetype on right before it. This is how the various commands work:

command 			detection            plugin       indent ~  
:filetype on                 on          unchanged    unchanged  
:filetype off                off            unchanged    unchanged  
:filetype plugin on          on          on           unchanged  
:filetype plugin off         unchanged      off          unchanged  
:filetype indent on          on          unchanged    on  
:filetype indent off         unchanged      unchanged    off  
:filetype plugin indent on   on          on           on  
:filetype plugin indent off  unchanged      off       off  

Line 170: Turn off NERD shutup. Do you get any use filetype complaints?

Other thoughts:

Is it possible the file on the non-working machine has a modified filetypes.vim? Diff the files. Are they exactly the same? Are the permissions the same?

link|improve this answer
1. Yes 2. filetype detection:ON plugin:ON indent: ON 3. No – joe-bbb Nov 10 '09 at 11:46
feedback

Recent versions of vim don't perform filetype detection automatically on startup, because you might set commands in your .vimrc that affect filetype detection.

Put the following code at the end of your .vimrc, and you'll get filetype detection again

filetype on
filetype plugin on
filetype indent on
link|improve this answer
unfortunately this did not work – joe-bbb Nov 10 '09 at 11:41
feedback

Few things. Since on one of those two your vimrc "works", it means the problem is in the other (I assume on the first one, everything is working satisfactory).

Vim can load config files from various directories which have different priorities of loading (one overwrites the other). See ":help vimfiles" to see which ones are those.

Second, try ":echo $myvimrc" to see from where your "latest" vimrc is being loaded from. Is it the one you're currently linking to ?

Third, as Dave already pointed, do you have a file in your vim directory, called "filetype.vim", and do you have an adequate filetype file ?

If none of these work out for you, do please also let us know which version of vim/gvim are you using

link|improve this answer
:echo $myvimrc shows me ~/Users/joe/.vimrc this is what I expected. MacVim Snapshot 47 works fine. MacVim 7.2 stable 1.2 (33.3) does not work fine. Ok I think I should probably update MacVim! Thanks for looking guys. – joe-bbb Nov 10 '09 at 11:51
feedback

Your Answer

 
or
required, but never shown