> for homework i am assigning myself the research of as many flavors
> of indenting as i can find -- my first objective will be to
> find out exactly how many options are being set with the command
> :set filtype plugin indent
:filetype plugin indent on
(note the difference in command-name and spelling) does the following:
1. Filetype detection is ON: whenever you open an existing file for
editing, create a new file, or change a file's name (using e.g.
":saveas"), Vim sources any "filetype.vim" scripts in any of the
directories mentioned in the 'runtimepath' option to determine the
filetype. These scripts always include $VIMRUNTIME/filetype.vim from the
distribution; they may include ~/.vim/filetype.vim if you have created
it. Near the end of $VIMRUNTIME/filetype.vim there is a line "runtime!
ftdetect/*.vim" to source additional (optional) scripts in e.g.
2. Filetype plugins are ON: whenever the 'filetype' is set for a file
(usually as a result of step 1), the ftplugin/ subdirectory of
'runtimepath' directories are searched (in the order of the
'runtimepath' option) for a .vim script whose name (before .vim) matches
the filetype. All such scripts, if any, are sourced in the order they
are found. These scripts are supposed to define buffer-local options
and/or buffer-local mappings and abbreviations for files of the given
3. Filetype indenting is ON: additionally, indent/ subdirectories are
searched the same way ftplugin/ subdirectories were searched at step 2.
These scripts are supposed to define how text in files of the given
filetype must be auto-indented.
In addition, if you have used ":syntax on", the 'syntax' option is set
to (usually) the same value as the filetype; and syntax/ subdirectories
of 'runtimepath' directories are searched for .vim scripts matching the
syntax name. These scripts are supposed to define the syntax groups for
files of the given syntax, and, if they create new syntax group names
(which is usually the case), to define default highlight links or
default highlight colors for use (if no colorscheme is already saying
how these new groups must be displayed) in three kinds of terminal,
namely B&W text, color text, and GUI.
Depending on the filetype and on what the corresponding scripts do, all
the above can be very simple (e.g. the c.vim indent plugin merely sets
'cindent' on) or very complex, including invocation of scripts for
different filetypes or syntaxes in order to handle special regions of
the file: for instance, the vim.vim syntax script (used for vim scripts)
invokes perl, ruby, python, tcl and (in Vim 7) scheme syntaxes to handle
scripts invoke C scripts (both syntax and ftplugin); and so on.
Options can also be set on a file-by-file basis if 'modeline' is TRUE
and 'modelines' is nonzero, which are the 'nocompatible' default in Vim.
Not every option can be set by modelines, for security reasons.