Wednesday, May 26, 2010

Re: List known filetypes?

On 26/05/10 11:53, Benct Philip Jonsson wrote:
> How can I get a list of known file types?
> Preferably with info which criteria they are recognized by
> (file suffix, interpreter directive...)
>
> (I suspect this is a faq, but none of help helpgrep or
> Google returns anything useful, or I can't come up with
> the right search term. :-? )
>
> TIA,
>
> /BP
>

The relevant help tags are
:help 'runtimepath'
:help filetype.txt
:help new-filetype
:help new-filetype-scripts

For the criteria, you can:

a) list the autocommands which identify them

:au filetypedetect

These autocommands are set by $VIMRUNTIME/filetype.vim; one of them runs
$VIMRUNTIME/scripts.vim to try to identify files from their contents
when the name, path, etc. are not enough.

b) check which filetypes have scripts to handle them

(gvim) Syntax => Show filetypes in menu

which, however, lists only preinstalled filetypes, and not with the name
under which the 'filetype' or 'syntax' option knows them;

or else, for each of the directories listed in the 'runtimepath' option,
list (using ls on Unix or dir, possibly dir /w to save space, on Windows):

<directory>/ftplugin/*.vim
<directory>/indent/*.vim
<directory>/syntax/*.vim

Note that 'filetype' (as used by ftplugin and indent scripts) and
'syntax' (as used by syntax scripts) are separate options, which have
usually the same value but could be different.

In a "vanilla" install of Vim with no third-party scripts installed, the
only value of <directory> above pointing to an existing, nonempty
directory is your $VIMRUNTIME directory.


Best regards,
Tony.

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