Lines Matching refs:file
7 Filetypes *filetype* *file-type*
17 1. Filetypes *filetypes* *file-types*
19 Vim can detect the type of file that is edited. This is done by checking the
20 file name and sometimes by inspecting the contents of the file for specific
24 To enable file type detection, use this command in your vimrc: >
26 Each time a new or existing file is edited, Vim will try to recognize the type
27 of the file and set the 'filetype' option. This will trigger the FileType
40 This file is a Vim script that defines autocommands for the
41 BufNewFile and BufRead events. If the file type is not found by the
42 name, the file $VIMRUNTIME/scripts.vim is used to detect it from the
43 contents of the file.
47 To add your own file types, see |new-filetype| below. To search for help on a
54 If the file type is not detected automatically, or it finds the wrong type,
56 file. Example, for an IDL file use the command: >
59 or add this |modeline| to the file:
63 You can enable loading the plugin files for specific file types with: >
66 This actually loads the file "ftplugin.vim" in 'runtimepath'.
67 The result is that when a file is edited its plugin file is loaded (if there
75 This actually loads the file "ftplugof.vim" in 'runtimepath'.
78 You can enable loading the indent file for specific file types with: >
81 This actually loads the file "indent.vim" in 'runtimepath'.
82 The result is that when a file is edited its indent file is loaded (if there
90 This actually loads the file "indoff.vim" in 'runtimepath'.
93 'indentexpr' to disable indenting in an opened file.
96 To disable file type detection, use this command: >
98 This will keep the flags for "plugin" and "indent", but since no file types
119 The file types are also used for syntax highlighting. If the ":syntax on"
120 command is used, the file type detection is installed too. There is no need
123 To disable one of the file types, add a line in your filetype file, see
127 To detect the file type again: >
129 Use this if you started with an empty file and typed text that makes it
130 possible to detect the file type. For example, when you entered this in a
137 kind of file it is. This doesn't always work. A number of global variables
140 file name variable ~
162 If a file type that you want to use is not detected yet, there are four ways
164 file. It will be overwritten when installing a new version of Vim.
166 A. If you want to overrule all default file type checks.
167 This works by writing one file for each filetype. The disadvantage is that
169 file in the right directory to make it work.
177 2. Create a file that contains an autocommand to detect the file type.
181 when sourcing your file. You could also use the pattern "*" and then
182 check the contents of the file to recognize it.
183 Write this file as "mine.vim" in the "ftdetect" directory in your user
190 checks, thus they can overrule a previously detected file type. But you
193 B. If you want to detect your file after the default file type checks.
196 use ":setfiletype". This will only set 'filetype' if no file type was
200 You can also use the already detected file type in your command. For
201 example, to use the file type "mypascal" when "pascal" has been detected: >
205 C. If your file type can be detected by the file name.
210 2. Create a file that contains autocommands to detect the file type.
212 " my filetype file
220 < Write this file as "filetype.vim" in your user runtime directory. For
232 file.
238 2. Create a vim script file for doing this. Example: >
248 Write this file as "scripts.vim" in your user runtime directory. For
254 Your scripts.vim is loaded before the default checks for file types, which
259 If a file type is detected that is wrong for you, install a filetype.vim or
276 On operating systems which support storing a file type with the file, you can
277 specify that an autocommand should only be executed if the file is of a
290 - Any file whose name ends in ".html"
291 - Any file whose type is "&faf" or "HTML", where the meaning of these types
355 < You need to check the description of the plugin file below for the
358 editing a file of that type). The plugin will then skip installing the
376 'runtimepath'. For Unix, for example you could use this file: >
387 < Then you can edit the copied file to your liking. Since the b:did_ftplugin
394 'runtimepath'. For Unix, for example, you could use this file: >
396 < In this file you can change just those settings that you want to change.
429 ftplugin/changelog.vim file first, e.g. with >
500 Name of the ChangeLog file to look for.
505 The default is empty, thus looking for a file named
509 recursively until a file is found or there are no more
523 After figuring out the current date and user, the file is searched for an
571 to the end of the file in Normal mode. This means "> " is inserted in
580 source this script from your startup |vimrc| file: >
628 For bash,zsh,ksh or dash, add to the config file (.bashrc,.zshrc, ...)
632 For (t)csh, add to the config file
636 For fish, add to the config file
714 file: |pi_spec.txt|.
720 file: |ft_rust.txt|.
726 file: |ft_sql.txt|.
731 If the first line of a *.tex file has the form >
733 then this determined the file type: plaintex (for plain TeX), context (for
734 ConTeXt), or tex (for LaTeX). Otherwise, the file is searched for keywords to
737 (not the file type) you use most. Use one of these: >