Tuesday, April 5, 2011

force use of scripts.vim to find filetype

I have a bunch of these executable scripts, with shebang lines, and I
want configure vim to detect the filetype using the shebang line. The
problem is that these scripts all must have the .foo extension
(they're run automatically by a build system), and the system-wide
filetype.vim recognizes .foo files as having a particular filetype,
which is not the one I want. Therefore, vim thinks it knows what kind
of files these are and never reads the shebang line.

How can I configure vim so that this incorrect recognition stops
happening? Basically, I want things so that when I open a .foo file,
it identifies the filetype only from the shebang line.

I tried using an autocmd to ignore the incorrect filetype:

autocmd BufNewFile,BufRead *.foo set filetype=ignored

But this leaves the files without any useful filetype at all. I
suspect that I need to somehow unset the filetype and then tell vim to
set it only from scripts.vim. However, I have no idea how to do this.
Any help would be much appreciated.

Alvin Kerber

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: