On 16/07/11 18:59, Javier Rojas wrote:
On Sat, Jul 16, 2011 at 11:22:43AM -0400, Eric Weir wrote:
You can check the contents of a file to figure out its filetype. Check

:help new-filetype-scripts

Thanks Javier. The help might help, but what I would like to do would be to 
include a class of files in an existing filetype, and to do it without relying 
on the extent, as these files do not have an extent and cannot be given one.

It was my understanding that there are other features that can be used to 
establish a filetype or to include a class of files in it.

In Vim you can define the type of a file using 2 methods:

   * checking its extension, or filename

This includes telling Vim that anything in $HOME/foo/bar/ is of filetype baz (/home/eric/foo/bar/* is a valid Unix glob for a "filename" here).

   * checking its contents, if the filename has no useful info for
     defining the filetype.

This is how Vim recognises any file whose contents start with #!/bin/sh as a shell script, even without an extension (some shell scripts are *.sh, but others have no filename extension).

In addition, for any file that includes a modeline (:help modeline) near the begin or end of the file (usually among the first five and last five lines) to set the filetype, you don't need any filetype-detecting script. Vim help files are an example (look at their last line).


The help section I pointed you to shows how to check the content of a
file to define its filetype.


Best regards,
Tony.
--
Rule of Feline Frustration:
        When your cat has fallen asleep on your lap and looks utterly
content and adorable, you will suddenly have to go to the bathroom.

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

Reply via email to