filetype unknown on startup

587 views
Skip to first unread message

JollyJ

unread,
Apr 20, 2012, 5:13:26 PM4/20/12
to v...@vim.org
Greetings,

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.

Ben Fritz

unread,
Apr 20, 2012, 6:00:07 PM4/20/12
to vim...@googlegroups.com, v...@vim.org
On Friday, April 20, 2012 4:13:26 PM UTC-5, JollyJ wrote:
> Greetings,
>
> 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.
>

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".

Gary Johnson

unread,
Apr 20, 2012, 7:48:06 PM4/20/12
to vim...@googlegroups.com
On 2012-04-20, JollyJ wrote:
> Greetings,
>
> 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

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

JollyJ

unread,
Apr 20, 2012, 7:58:26 PM4/20/12
to v...@vim.org
It worked.

Thanks for the aid.

--
View this message in context: http://vim.1045645.n5.nabble.com/filetype-unknown-on-startup-tp5655326p5655528.html

JollyJ

unread,
Apr 20, 2012, 6:45:37 PM4/20/12
to v...@vim.org
Thanks for the suggestion.

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

Gary Johnson

unread,
Apr 21, 2012, 6:31:26 PM4/21/12
to vim...@googlegroups.com
On 2012-04-20, JollyJ wrote:
> Thanks for the suggestion.
>
> 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.

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

Reply all
Reply to author
Forward
0 new messages