I am running Vim version 7.3.154 on Ubuntu Oneiric. I'm a newbie, and I
just set up a .vimrc file with the following commands:
set nocompatible
set hlsearch
set incsearch
set number
set showmode
set syntax=ON
color elflord
All of the features I intended to set work like a charm, the problem is that
now every time I open a file in VIM, i get the following error:
filetype unknown
Press ENTER or type command to continue
It does this with all files I've tried to open, (.cpp, .c++, .txt and the
.vimrc itself) It appears to me that the filetype.vim file should allow for
all these to be detected, but I don't know for sure what I am reading.
Funny thing is, the syntax highlighting still works even though the filetype
is supposedly unknown.
Any guidance would be greatly appreciated.
--
View this message in context: http://vim.1045645.n5.nabble.com/filetype-unknown-on-startup-tp5655326p5655326.html
Sent from the Vim - General mailing list archive at Nabble.com.
I have no idea why syntax highlighting would work without filetype detection. Try putting "filetype indent plugin on" prior to "syntax on" in your .vimrc (without the quotes). If you don't want automatic indenting, just use "filetype plugin on". If you also don't want filetype-specific settings, just "filetype on".
Try changing that line to
syntax on
> color elflord
>
> All of the features I intended to set work like a charm, the problem is that
> now every time I open a file in VIM, i get the following error:
>
> filetype unknown
> Press ENTER or type command to continue
>
> It does this with all files I've tried to open, (.cpp, .c++, .txt and the
> .vimrc itself) It appears to me that the filetype.vim file should allow for
> all these to be detected, but I don't know for sure what I am reading.
> Funny thing is, the syntax highlighting still works even though the filetype
> is supposedly unknown.
>
> Any guidance would be greatly appreciated.
I copied your commands to a new file, jollyjvimrc, and executed
$ vim -u jollyjvimrc foo.cpp
'filetype' wasn't being set at all and ":scriptnames" showed that
filetype.vim wasn't being sourced.
HTH,
Gary
I tried adding:
filetype indent plugin on
and still got the same results.
I started vim without the .vimrc and the error was gone, so I then tried
commenting different lines out in .vimrc. When I commented out the syntax
and filetype indent plugin commands, it works fine. No error, and all the
features requested in .vimrc work. Here's the odd part; syntax highlighting
still works!
I see that vim has many individual syntax files. Could it be that that the
regular vimrc applies the proper syntax highlighting based on file name
extension if a color scheme is selected? There is code in that file that
looks to me like it might do that; but again, I don't know what I'm reading.
--
View this message in context: http://vim.1045645.n5.nabble.com/filetype-unknown-on-startup-tp5655326p5655446.html
Syntax highlighting does not depend on the color scheme. The colors
used by the syntax highlighting commands depend on the colors
defined by the color scheme, but the syntax highlighting or syntax
file type selection does not.
Regards,
Gary