Mercurial > vim
annotate runtime/doc/filetype.txt @ 29285:729a7c00fabc
Update runtime files
Commit: https://github.com/vim/vim/commit/e1dc76fbf333243ecfdfc3c0a81ea9984913b4f5
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jun 25 18:01:32 2022 +0100
Update runtime files
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 25 Jun 2022 19:15:06 +0200 |
parents | 1e9e9d89f0ee |
children | dc4de65a7fb7 |
rev | line source |
---|---|
28517 | 1 *filetype.txt* For Vim version 8.2. Last change: 2022 Apr 09 |
7 | 2 |
3 | |
4 VIM REFERENCE MANUAL by Bram Moolenaar | |
5 | |
6 | |
7 Filetypes *filetype* *file-type* | |
8 | |
9 1. Filetypes |filetypes| | |
10 2. Filetype plugin |filetype-plugins| | |
11 3. Docs for the default filetype plugins. |ftplugin-docs| | |
12 | |
13 Also see |autocmd.txt|. | |
14 | |
15 | |
16 ============================================================================== | |
17 1. Filetypes *filetypes* *file-types* | |
18 | |
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 | |
21 text. | |
22 | |
23 *:filetype* *:filet* | |
24 To enable file type detection, use this command in your vimrc: > | |
25 :filetype on | |
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 | |
28 event, which can be used to set the syntax highlighting, set options, etc. | |
29 | |
30 NOTE: Filetypes and 'compatible' don't work together well, since being Vi | |
31 compatible means options are global. Resetting 'compatible' is recommended, | |
32 if you didn't do that already. | |
33 | |
34 Detail: The ":filetype on" command will load one of these files: | |
35 Amiga $VIMRUNTIME/filetype.vim | |
36 Mac $VIMRUNTIME:filetype.vim | |
18972 | 37 MS-Windows $VIMRUNTIME\filetype.vim |
7 | 38 Unix $VIMRUNTIME/filetype.vim |
39 VMS $VIMRUNTIME/filetype.vim | |
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. | |
12756
3b26420fc639
Long overdue runtime update.
Christian Brabandt <cb@256bit.org>
parents:
11262
diff
changeset
|
44 When the GUI is running or will start soon, the |menu.vim| script is |
1125 | 45 also sourced. See |'go-M'| about avoiding that. |
7 | 46 |
501 | 47 To add your own file types, see |new-filetype| below. To search for help on a |
48 filetype prepend "ft-" and optionally append "-syntax", "-indent" or | |
49 "-plugin". For example: > | |
50 :help ft-vim-indent | |
51 :help ft-vim-syntax | |
52 :help ft-man-plugin | |
7 | 53 |
54 If the file type is not detected automatically, or it finds the wrong type, | |
55 you can either set the 'filetype' option manually, or add a modeline to your | |
1668 | 56 file. Example, for an IDL file use the command: > |
7 | 57 :set filetype=idl |
501 | 58 |
59 or add this |modeline| to the file: | |
60 /* vim: set filetype=idl : */ ~ | |
61 | |
7 | 62 *:filetype-plugin-on* |
63 You can enable loading the plugin files for specific file types with: > | |
64 :filetype plugin on | |
65 If filetype detection was not switched on yet, it will be as well. | |
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 | |
68 is one for the detected filetype). |filetype-plugin| | |
69 | |
70 *:filetype-plugin-off* | |
71 You can disable it again with: > | |
72 :filetype plugin off | |
73 The filetype detection is not switched off then. But if you do switch off | |
74 filetype detection, the plugins will not be loaded either. | |
75 This actually loads the file "ftplugof.vim" in 'runtimepath'. | |
76 | |
77 *:filetype-indent-on* | |
78 You can enable loading the indent file for specific file types with: > | |
79 :filetype indent on | |
80 If filetype detection was not switched on yet, it will be as well. | |
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 | |
83 is one for the detected filetype). |indent-expression| | |
84 | |
85 *:filetype-indent-off* | |
86 You can disable it again with: > | |
87 :filetype indent off | |
88 The filetype detection is not switched off then. But if you do switch off | |
89 filetype detection, the indent files will not be loaded either. | |
90 This actually loads the file "indoff.vim" in 'runtimepath'. | |
22 | 91 This disables auto-indenting for files you will open. It will keep working in |
92 already opened files. Reset 'autoindent', 'cindent', 'smartindent' and/or | |
93 'indentexpr' to disable indenting in an opened file. | |
7 | 94 |
95 *:filetype-off* | |
96 To disable file type detection, use this command: > | |
97 :filetype off | |
98 This will keep the flags for "plugin" and "indent", but since no file types | |
99 are being detected, they won't work until the next ":filetype on". | |
100 | |
101 | |
102 Overview: *:filetype-overview* | |
103 | |
104 command detection plugin indent ~ | |
105 :filetype on on unchanged unchanged | |
106 :filetype off off unchanged unchanged | |
107 :filetype plugin on on on unchanged | |
108 :filetype plugin off unchanged off unchanged | |
109 :filetype indent on on unchanged on | |
110 :filetype indent off unchanged unchanged off | |
111 :filetype plugin indent on on on on | |
112 :filetype plugin indent off unchanged off off | |
113 | |
114 To see the current status, type: > | |
115 :filetype | |
116 The output looks something like this: > | |
117 filetype detection:ON plugin:ON indent:OFF | |
118 | |
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 | |
121 to do ":filetype on" after ":syntax on". | |
122 | |
1624 | 123 To disable one of the file types, add a line in your filetype file, see |
7 | 124 |remove-filetype|. |
125 | |
126 *filetype-detect* | |
127 To detect the file type again: > | |
128 :filetype detect | |
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 | |
131 shell script: "#!/bin/csh". | |
132 When filetype detection was off, it will be enabled first, like the "on" | |
133 argument was used. | |
134 | |
135 *filetype-overrule* | |
27321 | 136 When the same extension is used for multiple filetypes, Vim tries to guess |
137 what kind of file it is. This doesn't always work. A number of global | |
138 variables can be used to overrule the filetype used for certain extensions: | |
7 | 139 |
140 file name variable ~ | |
501 | 141 *.asa g:filetype_asa |ft-aspvbs-syntax| |ft-aspperl-syntax| |
26311
ce3678583211
patch 8.2.3686: filetype detection often mixes up Forth and F#
Bram Moolenaar <Bram@vim.org>
parents:
25880
diff
changeset
|
142 *.asm g:asmsyntax |ft-asm-syntax| |
501 | 143 *.asp g:filetype_asp |ft-aspvbs-syntax| |ft-aspperl-syntax| |
27321 | 144 *.bas g:filetype_bas |ft-basic-syntax| |
28392
f77b9d4cb007
patch 8.2.4720: ABB Rapid files are not recognized properly
Bram Moolenaar <Bram@vim.org>
parents:
28390
diff
changeset
|
145 *.cfg g:filetype_cfg |
28620 | 146 *.csh g:filetype_csh |ft-csh-syntax| |
28379 | 147 *.dat g:filetype_dat |
27537 | 148 *.frm g:filetype_frm |ft-form-syntax| |
149 *.fs g:filetype_fs |ft-forth-syntax| | |
26311
ce3678583211
patch 8.2.3686: filetype detection often mixes up Forth and F#
Bram Moolenaar <Bram@vim.org>
parents:
25880
diff
changeset
|
150 *.i g:filetype_i |ft-progress-syntax| |
7 | 151 *.inc g:filetype_inc |
25727
71d3ebfb00b6
patch 8.2.3399: Octave files are not recognized
Bram Moolenaar <Bram@vim.org>
parents:
24911
diff
changeset
|
152 *.m g:filetype_m |ft-mathematica-syntax| |
28390
cc4d3ded4004
patch 8.2.0003: Build file dependencies are incomplete
Bram Moolenaar <Bram@vim.org>
parents:
28379
diff
changeset
|
153 *.mod g:filetype_mod |
501 | 154 *.p g:filetype_p |ft-pascal-syntax| |
26311
ce3678583211
patch 8.2.3686: filetype detection often mixes up Forth and F#
Bram Moolenaar <Bram@vim.org>
parents:
25880
diff
changeset
|
155 *.pl g:filetype_pl |
23666 | 156 *.pp g:filetype_pp |ft-pascal-syntax| |
26311
ce3678583211
patch 8.2.3686: filetype detection often mixes up Forth and F#
Bram Moolenaar <Bram@vim.org>
parents:
25880
diff
changeset
|
157 *.prg g:filetype_prg |
28620 | 158 *.r g:filetype_r |
159 *.sql g:filetype_sql |ft-sql-syntax| | |
28379 | 160 *.src g:filetype_src |
28445
7f0ec490d608
patch 8.2.4747: no filetype override for .sys files
Bram Moolenaar <Bram@vim.org>
parents:
28392
diff
changeset
|
161 *.sys g:filetype_sys |
501 | 162 *.sh g:bash_is_sh |ft-sh-syntax| |
798 | 163 *.tex g:tex_flavor |ft-tex-plugin| |
26311
ce3678583211
patch 8.2.3686: filetype detection often mixes up Forth and F#
Bram Moolenaar <Bram@vim.org>
parents:
25880
diff
changeset
|
164 *.w g:filetype_w |ft-cweb-syntax| |
7 | 165 |
28379 | 166 For a few filetypes the global variable is used only when the filetype could |
167 not be detected: | |
168 *.r g:filetype_r |ft-rexx-syntax| | |
169 | |
7 | 170 *filetype-ignore* |
171 To avoid that certain files are being inspected, the g:ft_ignore_pat variable | |
172 is used. The default value is set like this: > | |
173 :let g:ft_ignore_pat = '\.\(Z\|gz\|bz2\|zip\|tgz\)$' | |
174 This means that the contents of compressed files are not inspected. | |
175 | |
176 *new-filetype* | |
22 | 177 If a file type that you want to use is not detected yet, there are four ways |
10 | 178 to add it. In any way, it's better not to modify the $VIMRUNTIME/filetype.vim |
7 | 179 file. It will be overwritten when installing a new version of Vim. |
180 | |
181 A. If you want to overrule all default file type checks. | |
182 This works by writing one file for each filetype. The disadvantage is that | |
21825 | 183 there can be many files. The advantage is that you can simply drop this |
184 file in the right directory to make it work. | |
22 | 185 *ftdetect* |
7 | 186 1. Create your user runtime directory. You would normally use the first |
187 item of the 'runtimepath' option. Then create the directory "ftdetect" | |
188 inside it. Example for Unix: > | |
189 :!mkdir ~/.vim | |
190 :!mkdir ~/.vim/ftdetect | |
191 < | |
192 2. Create a file that contains an autocommand to detect the file type. | |
193 Example: > | |
194 au BufRead,BufNewFile *.mine set filetype=mine | |
195 < Note that there is no "augroup" command, this has already been done | |
196 when sourcing your file. You could also use the pattern "*" and then | |
197 check the contents of the file to recognize it. | |
198 Write this file as "mine.vim" in the "ftdetect" directory in your user | |
199 runtime directory. For example, for Unix: > | |
200 :w ~/.vim/ftdetect/mine.vim | |
201 | |
202 < 3. To use the new filetype detection you must restart Vim. | |
203 | |
204 The files in the "ftdetect" directory are used after all the default | |
530 | 205 checks, thus they can overrule a previously detected file type. But you |
206 can also use |:setfiletype| to keep a previously detected filetype. | |
7 | 207 |
208 B. If you want to detect your file after the default file type checks. | |
209 | |
210 This works like A above, but instead of setting 'filetype' unconditionally | |
211 use ":setfiletype". This will only set 'filetype' if no file type was | |
212 detected yet. Example: > | |
213 au BufRead,BufNewFile *.txt setfiletype text | |
214 < | |
215 You can also use the already detected file type in your command. For | |
216 example, to use the file type "mypascal" when "pascal" has been detected: > | |
217 au BufRead,BufNewFile * if &ft == 'pascal' | set ft=mypascal | |
218 | endif | |
219 | |
220 C. If your file type can be detected by the file name. | |
221 1. Create your user runtime directory. You would normally use the first | |
222 item of the 'runtimepath' option. Example for Unix: > | |
223 :!mkdir ~/.vim | |
224 < | |
225 2. Create a file that contains autocommands to detect the file type. | |
226 Example: > | |
227 " my filetype file | |
228 if exists("did_load_filetypes") | |
229 finish | |
230 endif | |
231 augroup filetypedetect | |
232 au! BufRead,BufNewFile *.mine setfiletype mine | |
233 au! BufRead,BufNewFile *.xyz setfiletype drawing | |
234 augroup END | |
235 < Write this file as "filetype.vim" in your user runtime directory. For | |
236 example, for Unix: > | |
237 :w ~/.vim/filetype.vim | |
238 | |
239 < 3. To use the new filetype detection you must restart Vim. | |
240 | |
241 Your filetype.vim will be sourced before the default FileType autocommands | |
242 have been installed. Your autocommands will match first, and the | |
243 ":setfiletype" command will make sure that no other autocommands will set | |
244 'filetype' after this. | |
245 *new-filetype-scripts* | |
246 D. If your filetype can only be detected by inspecting the contents of the | |
247 file. | |
248 | |
249 1. Create your user runtime directory. You would normally use the first | |
250 item of the 'runtimepath' option. Example for Unix: > | |
251 :!mkdir ~/.vim | |
252 < | |
253 2. Create a vim script file for doing this. Example: > | |
254 if did_filetype() " filetype already set.. | |
255 finish " ..don't do these checks | |
256 endif | |
257 if getline(1) =~ '^#!.*\<mine\>' | |
258 setfiletype mine | |
259 elseif getline(1) =~? '\<drawing\>' | |
260 setfiletype drawing | |
261 endif | |
262 < See $VIMRUNTIME/scripts.vim for more examples. | |
263 Write this file as "scripts.vim" in your user runtime directory. For | |
264 example, for Unix: > | |
265 :w ~/.vim/scripts.vim | |
266 < | |
267 3. The detection will work right away, no need to restart Vim. | |
268 | |
269 Your scripts.vim is loaded before the default checks for file types, which | |
270 means that your rules override the default rules in | |
271 $VIMRUNTIME/scripts.vim. | |
272 | |
273 *remove-filetype* | |
274 If a file type is detected that is wrong for you, install a filetype.vim or | |
275 scripts.vim to catch it (see above). You can set 'filetype' to a non-existing | |
276 name to avoid that it will be set later anyway: > | |
277 :set filetype=ignored | |
278 | |
279 If you are setting up a system with many users, and you don't want each user | |
280 to add/remove the same filetypes, consider writing the filetype.vim and | |
281 scripts.vim files in a runtime directory that is used for everybody. Check | |
282 the 'runtimepath' for a directory to use. If there isn't one, set | |
283 'runtimepath' in the |system-vimrc|. Be careful to keep the default | |
284 directories! | |
285 | |
286 | |
287 *autocmd-osfiletypes* | |
2908 | 288 NOTE: this code is currently disabled, as the RISC OS implementation was |
289 removed. In the future this will use the 'filetype' option. | |
290 | |
7 | 291 On operating systems which support storing a file type with the file, you can |
292 specify that an autocommand should only be executed if the file is of a | |
293 certain type. | |
294 | |
295 The actual type checking depends on which platform you are running Vim | |
296 on; see your system's documentation for details. | |
297 | |
298 To use osfiletype checking in an autocommand you should put a list of types to | |
299 match in angle brackets in place of a pattern, like this: > | |
300 | |
301 :au BufRead *.html,<&faf;HTML> runtime! syntax/html.vim | |
302 | |
303 This will match: | |
304 | |
1668 | 305 - Any file whose name ends in ".html" |
306 - Any file whose type is "&faf" or "HTML", where the meaning of these types | |
7 | 307 depends on which version of Vim you are using. |
308 Unknown types are considered NOT to match. | |
309 | |
310 You can also specify a type and a pattern at the same time (in which case they | |
311 must both match): > | |
312 | |
313 :au BufRead <&fff>diff* | |
314 | |
1668 | 315 This will match files of type "&fff" whose names start with "diff". |
7 | 316 |
317 | |
318 *plugin-details* | |
319 The "plugin" directory can be in any of the directories in the 'runtimepath' | |
320 option. All of these directories will be searched for plugins and they are | |
321 all loaded. For example, if this command: > | |
322 | |
323 set runtimepath | |
324 | |
1125 | 325 produces this output: |
7 | 326 |
19116 | 327 runtimepath=/etc/vim,~/.vim,/usr/local/share/vim/vim82 ~ |
7 | 328 |
1125 | 329 then Vim will load all plugins in these directories and below: |
7 | 330 |
1125 | 331 /etc/vim/plugin/ ~ |
332 ~/.vim/plugin/ ~ | |
19116 | 333 /usr/local/share/vim/vim82/plugin/ ~ |
7 | 334 |
335 Note that the last one is the value of $VIMRUNTIME which has been expanded. | |
336 | |
13735 | 337 Note that when using a plugin manager or |packages| many directories will be |
14249
4543777545a3
Updated runtime and language files.
Christian Brabandt <cb@256bit.org>
parents:
13963
diff
changeset
|
338 added to 'runtimepath'. These plugins each require their own directory, don't |
4543777545a3
Updated runtime and language files.
Christian Brabandt <cb@256bit.org>
parents:
13963
diff
changeset
|
339 put them directly in ~/.vim/plugin. |
13735 | 340 |
7 | 341 What if it looks like your plugin is not being loaded? You can find out what |
342 happens when Vim starts up by using the |-V| argument: > | |
1125 | 343 |
344 vim -V2 | |
345 | |
7 | 346 You will see a lot of messages, in between them is a remark about loading the |
1125 | 347 plugins. It starts with: |
348 | |
349 Searching for "plugin/**/*.vim" in ~ | |
350 | |
7 | 351 There you can see where Vim looks for your plugin scripts. |
352 | |
353 ============================================================================== | |
354 2. Filetype plugin *filetype-plugins* | |
355 | |
356 When loading filetype plugins has been enabled |:filetype-plugin-on|, options | |
357 will be set and mappings defined. These are all local to the buffer, they | |
358 will not be used for other files. | |
359 | |
360 Defining mappings for a filetype may get in the way of the mappings you | |
361 define yourself. There are a few ways to avoid this: | |
362 1. Set the "maplocalleader" variable to the key sequence you want the mappings | |
363 to start with. Example: > | |
364 :let maplocalleader = "," | |
365 < All mappings will then start with a comma instead of the default, which | |
366 is a backslash. Also see |<LocalLeader>|. | |
367 | |
368 2. Define your own mapping. Example: > | |
369 :map ,p <Plug>MailQuote | |
370 < You need to check the description of the plugin file below for the | |
371 functionality it offers and the string to map to. | |
372 You need to define your own mapping before the plugin is loaded (before | |
373 editing a file of that type). The plugin will then skip installing the | |
374 default mapping. | |
26847 | 375 *no_mail_maps* *g:no_mail_maps* |
7 | 376 3. Disable defining mappings for a specific filetype by setting a variable, |
377 which contains the name of the filetype. For the "mail" filetype this | |
378 would be: > | |
379 :let no_mail_maps = 1 | |
26847 | 380 < *no_plugin_maps* *g:no_plugin_maps* |
7 | 381 4. Disable defining mappings for all filetypes by setting a variable: > |
382 :let no_plugin_maps = 1 | |
383 < | |
384 | |
385 *ftplugin-overrule* | |
386 If a global filetype plugin does not do exactly what you want, there are three | |
387 ways to change this: | |
388 | |
389 1. Add a few settings. | |
390 You must create a new filetype plugin in a directory early in | |
391 'runtimepath'. For Unix, for example you could use this file: > | |
392 vim ~/.vim/ftplugin/fortran.vim | |
393 < You can set those settings and mappings that you would like to add. Note | |
394 that the global plugin will be loaded after this, it may overrule the | |
395 settings that you do here. If this is the case, you need to use one of the | |
396 following two methods. | |
397 | |
398 2. Make a copy of the plugin and change it. | |
399 You must put the copy in a directory early in 'runtimepath'. For Unix, for | |
400 example, you could do this: > | |
401 cp $VIMRUNTIME/ftplugin/fortran.vim ~/.vim/ftplugin/fortran.vim | |
402 < Then you can edit the copied file to your liking. Since the b:did_ftplugin | |
403 variable will be set, the global plugin will not be loaded. | |
404 A disadvantage of this method is that when the distributed plugin gets | |
405 improved, you will have to copy and modify it again. | |
406 | |
407 3. Overrule the settings after loading the global plugin. | |
408 You must create a new filetype plugin in a directory from the end of | |
409 'runtimepath'. For Unix, for example, you could use this file: > | |
410 vim ~/.vim/after/ftplugin/fortran.vim | |
411 < In this file you can change just those settings that you want to change. | |
412 | |
413 ============================================================================== | |
414 3. Docs for the default filetype plugins. *ftplugin-docs* | |
415 | |
416 | |
22441 | 417 AWK *ft-awk-plugin* |
418 | |
419 Support for features specific to GNU Awk, like @include, can be enabled by | |
420 setting: > | |
421 let g:awk_is_gawk = 1 | |
422 | |
423 | |
501 | 424 CHANGELOG *ft-changelog-plugin* |
7 | 425 |
237 | 426 Allows for easy entrance of Changelog entries in Changelog files. There are |
7 | 427 some commands, mappings, and variables worth exploring: |
428 | |
429 Options: | |
430 'comments' is made empty to not mess up formatting. | |
431 'textwidth' is set to 78, which is standard. | |
432 'formatoptions' the 't' flag is added to wrap when inserting text. | |
433 | |
434 Commands: | |
435 NewChangelogEntry Adds a new Changelog entry in an intelligent fashion | |
436 (see below). | |
437 | |
438 Local mappings: | |
439 <Leader>o Starts a new Changelog entry in an equally intelligent | |
440 fashion (see below). | |
441 | |
442 Global mappings: | |
443 NOTE: The global mappings are accessed by sourcing the | |
444 ftplugin/changelog.vim file first, e.g. with > | |
497 | 445 runtime ftplugin/changelog.vim |
7 | 446 < in your |.vimrc|. |
447 <Leader>o Switches to the ChangeLog buffer opened for the | |
448 current directory, or opens it in a new buffer if it | |
449 exists in the current directory. Then it does the | |
450 same as the local <Leader>o described above. | |
451 | |
452 Variables: | |
1226 | 453 g:changelog_timeformat Deprecated; use g:changelog_dateformat instead. |
454 g:changelog_dateformat The date (and time) format used in ChangeLog entries. | |
7 | 455 The format accepted is the same as for the |
456 |strftime()| function. | |
457 The default is "%Y-%m-%d" which is the standard format | |
458 for many ChangeLog layouts. | |
459 g:changelog_username The name and email address of the user. | |
460 The default is deduced from environment variables and | |
461 system files. It searches /etc/passwd for the comment | |
462 part of the current user, which informally contains | |
463 the real name of the user up to the first separating | |
464 comma. then it checks the $NAME environment variable | |
465 and finally runs `whoami` and `hostname` to build an | |
466 email address. The final form is > | |
467 Full Name <user@host> | |
468 < | |
469 g:changelog_new_date_format | |
470 The format to use when creating a new date-entry. | |
471 The following table describes special tokens in the | |
472 string: | |
473 %% insert a single '%' character | |
474 %d insert the date from above | |
475 %u insert the user from above | |
5568 | 476 %p insert result of b:changelog_entry_prefix |
7 | 477 %c where to position cursor when done |
5568 | 478 The default is "%d %u\n\n\t* %p%c\n\n", which produces |
7 | 479 something like (| is where cursor will be, unless at |
480 the start of the line where it denotes the beginning | |
481 of the line) > | |
482 |2003-01-14 Full Name <user@host> | |
483 | | |
5568 | 484 | * prefix| |
7 | 485 < |
486 g:changelog_new_entry_format | |
487 The format used when creating a new entry. | |
488 The following table describes special tokens in the | |
489 string: | |
5568 | 490 %p insert result of b:changelog_entry_prefix |
7 | 491 %c where to position cursor when done |
492 The default is "\t*%c", which produces something | |
493 similar to > | |
5568 | 494 | * prefix| |
7 | 495 < |
496 g:changelog_date_entry_search | |
497 The search pattern to use when searching for a | |
498 date-entry. | |
499 The same tokens that can be used for | |
500 g:changelog_new_date_format can be used here as well. | |
501 The default is '^\s*%d\_s*%u' which finds lines | |
502 matching the form > | |
503 |2003-01-14 Full Name <user@host> | |
504 < and some similar formats. | |
505 | |
1226 | 506 g:changelog_date_end_entry_search |
507 The search pattern to use when searching for the end | |
508 of a date-entry. | |
509 The same tokens that can be used for | |
510 g:changelog_new_date_format can be used here as well. | |
511 The default is '^\s*$' which finds lines that contain | |
512 only whitespace or are completely empty. | |
513 | |
1698 | 514 b:changelog_name *b:changelog_name* |
515 Name of the ChangeLog file to look for. | |
516 The default is 'ChangeLog'. | |
517 | |
518 b:changelog_path | |
519 Path of the ChangeLog to use for the current buffer. | |
520 The default is empty, thus looking for a file named | |
521 |b:changelog_name| in the same directory as the | |
522 current buffer. If not found, the parent directory of | |
523 the current buffer is searched. This continues | |
524 recursively until a file is found or there are no more | |
525 parent directories to search. | |
526 | |
527 b:changelog_entry_prefix | |
528 Name of a function to call to generate a prefix to a | |
529 new entry. This function takes no arguments and | |
530 should return a string containing the prefix. | |
531 Returning an empty prefix is fine. | |
532 The default generates the shortest path between the | |
533 ChangeLog's pathname and the current buffers pathname. | |
534 In the future, it will also be possible to use other | |
535 variable contexts for this variable, for example, g:. | |
536 | |
7 | 537 The Changelog entries are inserted where they add the least amount of text. |
538 After figuring out the current date and user, the file is searched for an | |
539 entry beginning with the current date and user and if found adds another item | |
237 | 540 under it. If not found, a new entry and item is prepended to the beginning of |
7 | 541 the Changelog. |
542 | |
543 | |
501 | 544 FORTRAN *ft-fortran-plugin* |
7 | 545 |
546 Options: | |
547 'expandtab' is switched on to avoid tabs as required by the Fortran | |
548 standards unless the user has set fortran_have_tabs in .vimrc. | |
549 'textwidth' is set to 72 for fixed source format as required by the | |
550 Fortran standards and to 80 for free source format. | |
551 'formatoptions' is set to break code and comment lines and to preserve long | |
237 | 552 lines. You can format comments with |gq|. |
7 | 553 For further discussion of fortran_have_tabs and the method used for the |
501 | 554 detection of source format see |ft-fortran-syntax|. |
7 | 555 |
556 | |
1624 | 557 GIT COMMIT *ft-gitcommit-plugin* |
558 | |
559 One command, :DiffGitCached, is provided to show a diff of the current commit | |
560 in the preview window. It is equivalent to calling "git diff --cached" plus | |
561 any arguments given to the command. | |
562 | |
25880 | 563 GPROF *ft-gprof-plugin* |
25836 | 564 |
565 The gprof filetype plugin defines a mapping <C-]> to jump from a function | |
566 entry in the gprof flat profile or from a function entry in the call graph | |
567 to the details of that function in the call graph. | |
568 | |
569 The mapping can be disabled with: > | |
570 let g:no_gprof_maps = 1 | |
1624 | 571 |
501 | 572 MAIL *ft-mail-plugin* |
7 | 573 |
574 Options: | |
575 'modeline' is switched off to avoid the danger of trojan horses, and to | |
576 avoid that a Subject line with "Vim:" in it will cause an | |
577 error message. | |
578 'textwidth' is set to 72. This is often recommended for e-mail. | |
579 'formatoptions' is set to break text lines and to repeat the comment leader | |
580 in new lines, so that a leading ">" for quotes is repeated. | |
581 You can also format quoted text with |gq|. | |
582 | |
583 Local mappings: | |
584 <LocalLeader>q or \\MailQuote | |
585 Quotes the text selected in Visual mode, or from the cursor position | |
586 to the end of the file in Normal mode. This means "> " is inserted in | |
587 each line. | |
588 | |
7315
444efa5f5015
commit https://github.com/vim/vim/commit/2c5e8e80eacf491d4f266983f534a77776c7ae83
Christian Brabandt <cb@256bit.org>
parents:
7272
diff
changeset
|
589 MAN *ft-man-plugin* *:Man* *man.vim* |
7 | 590 |
23047 | 591 This plugin displays a manual page in a nice way. See |find-manpage| in the |
592 user manual for more information. | |
7 | 593 |
23047 | 594 To start using the |:Man| command before any manual page has been loaded, |
595 source this script from your startup |vimrc| file: > | |
7 | 596 runtime ftplugin/man.vim |
597 | |
598 Options: | |
23047 | 599 'iskeyword' The '.' character is added to support the use of CTRL-] on the |
7 | 600 manual page name. |
601 | |
602 Commands: | |
603 Man {name} Display the manual page for {name} in a window. | |
604 Man {number} {name} | |
605 Display the manual page for {name} in a section {number}. | |
606 | |
607 Global mapping: | |
608 <Leader>K Displays the manual page for the word under the cursor. | |
23047 | 609 <Plug>ManPreGetPage |
610 idem, allows for using a mapping: > | |
611 nmap <F1> <Plug>ManPreGetPage | |
7 | 612 |
613 Local mappings: | |
614 CTRL-] Jump to the manual page for the word under the cursor. | |
615 CTRL-T Jump back to the previous manual page. | |
23047 | 616 q Same as the |:quit| command. |
7272
17333ebd2bbd
commit https://github.com/vim/vim/commit/d042dc825c9b97dacd84d4728f88300da4d5b6b9
Christian Brabandt <cb@256bit.org>
parents:
5568
diff
changeset
|
617 |
9344
33c1b85d408c
commit https://github.com/vim/vim/commit/802a0d902fca423acb15f835d7b09183883d79a0
Christian Brabandt <cb@256bit.org>
parents:
9116
diff
changeset
|
618 To use a vertical split instead of horizontal: > |
33c1b85d408c
commit https://github.com/vim/vim/commit/802a0d902fca423acb15f835d7b09183883d79a0
Christian Brabandt <cb@256bit.org>
parents:
9116
diff
changeset
|
619 let g:ft_man_open_mode = 'vert' |
33c1b85d408c
commit https://github.com/vim/vim/commit/802a0d902fca423acb15f835d7b09183883d79a0
Christian Brabandt <cb@256bit.org>
parents:
9116
diff
changeset
|
620 To use a new tab: > |
33c1b85d408c
commit https://github.com/vim/vim/commit/802a0d902fca423acb15f835d7b09183883d79a0
Christian Brabandt <cb@256bit.org>
parents:
9116
diff
changeset
|
621 let g:ft_man_open_mode = 'tab' |
33c1b85d408c
commit https://github.com/vim/vim/commit/802a0d902fca423acb15f835d7b09183883d79a0
Christian Brabandt <cb@256bit.org>
parents:
9116
diff
changeset
|
622 |
23047 | 623 To enable |folding|, use this: > |
624 let g:ft_man_folding_enable = 1 | |
625 If you do not like the default folding, use an |autocommand| to add your desired | |
7384
aea5ebf352c4
commit https://github.com/vim/vim/commit/256972a9849b5d575b62a6a71be5b6934b5b0e8b
Christian Brabandt <cb@256bit.org>
parents:
7315
diff
changeset
|
626 folding style instead. For example: > |
23047 | 627 autocmd FileType man setlocal foldmethod=indent foldenable |
7 | 628 |
18186 | 629 If you would like :Man {number} {name} to behave like man {number} {name} by |
630 not running man {name} if no page is found, then use this: > | |
631 let g:ft_man_no_sect_fallback = 1 | |
632 | |
9116
bc38030aec7d
commit https://github.com/vim/vim/commit/26852128a2b713ef49341a0c18daba928444e7eb
Christian Brabandt <cb@256bit.org>
parents:
9041
diff
changeset
|
633 You may also want to set 'keywordprg' to make the |K| command open a manual |
bc38030aec7d
commit https://github.com/vim/vim/commit/26852128a2b713ef49341a0c18daba928444e7eb
Christian Brabandt <cb@256bit.org>
parents:
9041
diff
changeset
|
634 page in a Vim window: > |
bc38030aec7d
commit https://github.com/vim/vim/commit/26852128a2b713ef49341a0c18daba928444e7eb
Christian Brabandt <cb@256bit.org>
parents:
9041
diff
changeset
|
635 set keywordprg=:Man |
bc38030aec7d
commit https://github.com/vim/vim/commit/26852128a2b713ef49341a0c18daba928444e7eb
Christian Brabandt <cb@256bit.org>
parents:
9041
diff
changeset
|
636 |
7 | 637 |
9041
34c45ee4210d
commit https://github.com/vim/vim/commit/06481427005a9dae39721087df94855f7d4d1feb
Christian Brabandt <cb@256bit.org>
parents:
7384
diff
changeset
|
638 MANPAGER *manpager.vim* |
34c45ee4210d
commit https://github.com/vim/vim/commit/06481427005a9dae39721087df94855f7d4d1feb
Christian Brabandt <cb@256bit.org>
parents:
7384
diff
changeset
|
639 |
23047 | 640 The |:Man| command allows you to turn Vim into a manpager (that syntax highlights |
9041
34c45ee4210d
commit https://github.com/vim/vim/commit/06481427005a9dae39721087df94855f7d4d1feb
Christian Brabandt <cb@256bit.org>
parents:
7384
diff
changeset
|
641 manpages and follows linked manpages on hitting CTRL-]). |
34c45ee4210d
commit https://github.com/vim/vim/commit/06481427005a9dae39721087df94855f7d4d1feb
Christian Brabandt <cb@256bit.org>
parents:
7384
diff
changeset
|
642 |
12826 | 643 For bash,zsh,ksh or dash, add to the config file (.bashrc,.zshrc, ...) |
9041
34c45ee4210d
commit https://github.com/vim/vim/commit/06481427005a9dae39721087df94855f7d4d1feb
Christian Brabandt <cb@256bit.org>
parents:
7384
diff
changeset
|
644 |
29193 | 645 export MANPAGER="vim +MANPAGER --not-a-term -" |
9041
34c45ee4210d
commit https://github.com/vim/vim/commit/06481427005a9dae39721087df94855f7d4d1feb
Christian Brabandt <cb@256bit.org>
parents:
7384
diff
changeset
|
646 |
12826 | 647 For (t)csh, add to the config file |
648 | |
29193 | 649 setenv MANPAGER "vim +MANPAGER --not-a-term -" |
12826 | 650 |
651 For fish, add to the config file | |
652 | |
29193 | 653 set -x MANPAGER "vim +MANPAGER --not-a-term -" |
9041
34c45ee4210d
commit https://github.com/vim/vim/commit/06481427005a9dae39721087df94855f7d4d1feb
Christian Brabandt <cb@256bit.org>
parents:
7384
diff
changeset
|
654 |
24103 | 655 |
656 MARKDOWN *ft-markdown-plugin* | |
657 | |
658 To enable folding use this: > | |
24911 | 659 let g:markdown_folding = 1 |
24103 | 660 < |
661 | |
1624 | 662 PDF *ft-pdf-plugin* |
663 | |
664 Two maps, <C-]> and <C-T>, are provided to simulate a tag stack for navigating | |
665 the PDF. The following are treated as tags: | |
666 | |
667 - The byte offset after "startxref" to the xref table | |
668 - The byte offset after the /Prev key in the trailer to an earlier xref table | |
669 - A line of the form "0123456789 00000 n" in the xref table | |
670 - An object reference like "1 0 R" anywhere in the PDF | |
671 | |
672 These maps can be disabled with > | |
673 :let g:no_pdf_maps = 1 | |
674 < | |
675 | |
10186
a5ef9968638c
commit https://github.com/vim/vim/commit/7e1479b86c590a66b63a274c079b7f18907d45a4
Christian Brabandt <cb@256bit.org>
parents:
9344
diff
changeset
|
676 PYTHON *ft-python-plugin* *PEP8* |
a5ef9968638c
commit https://github.com/vim/vim/commit/7e1479b86c590a66b63a274c079b7f18907d45a4
Christian Brabandt <cb@256bit.org>
parents:
9344
diff
changeset
|
677 |
a5ef9968638c
commit https://github.com/vim/vim/commit/7e1479b86c590a66b63a274c079b7f18907d45a4
Christian Brabandt <cb@256bit.org>
parents:
9344
diff
changeset
|
678 By default the following options are set, in accordance with PEP8: > |
a5ef9968638c
commit https://github.com/vim/vim/commit/7e1479b86c590a66b63a274c079b7f18907d45a4
Christian Brabandt <cb@256bit.org>
parents:
9344
diff
changeset
|
679 |
a5ef9968638c
commit https://github.com/vim/vim/commit/7e1479b86c590a66b63a274c079b7f18907d45a4
Christian Brabandt <cb@256bit.org>
parents:
9344
diff
changeset
|
680 setlocal expandtab shiftwidth=4 softtabstop=4 tabstop=8 |
a5ef9968638c
commit https://github.com/vim/vim/commit/7e1479b86c590a66b63a274c079b7f18907d45a4
Christian Brabandt <cb@256bit.org>
parents:
9344
diff
changeset
|
681 |
14637 | 682 To disable this behavior, set the following variable in your vimrc: > |
13231 | 683 |
10186
a5ef9968638c
commit https://github.com/vim/vim/commit/7e1479b86c590a66b63a274c079b7f18907d45a4
Christian Brabandt <cb@256bit.org>
parents:
9344
diff
changeset
|
684 let g:python_recommended_style = 0 |
a5ef9968638c
commit https://github.com/vim/vim/commit/7e1479b86c590a66b63a274c079b7f18907d45a4
Christian Brabandt <cb@256bit.org>
parents:
9344
diff
changeset
|
685 |
a5ef9968638c
commit https://github.com/vim/vim/commit/7e1479b86c590a66b63a274c079b7f18907d45a4
Christian Brabandt <cb@256bit.org>
parents:
9344
diff
changeset
|
686 |
17433 | 687 QF QUICKFIX *qf.vim* *ft-qf-plugin* |
688 | |
689 The "qf" filetype is used for the quickfix window, see |quickfix-window|. | |
690 | |
691 The quickfix filetype plugin includes configuration for displaying the command | |
692 that produced the quickfix list in the |status-line|. To disable this setting, | |
693 configure as follows: > | |
694 :let g:qf_disable_statusline = 1 | |
695 | |
696 | |
14637 | 697 R MARKDOWN *ft-rmd-plugin* |
698 | |
699 By default ftplugin/html.vim is not sourced. If you want it sourced, add to | |
700 your |vimrc|: > | |
701 let rmd_include_html = 1 | |
702 | |
703 The 'formatexpr' option is set dynamically with different values for R code | |
704 and for Markdown code. If you prefer that 'formatexpr' is not set, add to your | |
705 |vimrc|: > | |
706 let rmd_dynamic_comments = 0 | |
707 | |
708 | |
709 R RESTRUCTURED TEXT *ft-rrst-plugin* | |
710 | |
711 The 'formatexpr' option is set dynamically with different values for R code | |
712 and for ReStructured text. If you prefer that 'formatexpr' is not set, add to | |
713 your |vimrc|: > | |
714 let rrst_dynamic_comments = 0 | |
715 | |
716 | |
15878 | 717 RESTRUCTUREDTEXT *ft-rst-plugin* |
718 | |
719 The following formatting setting are optionally available: > | |
720 setlocal expandtab shiftwidth=3 softtabstop=3 tabstop=8 | |
721 | |
722 To enable this behavior, set the following variable in your vimrc: > | |
723 let g:rst_style = 1 | |
724 | |
725 | |
501 | 726 RPM SPEC *ft-spec-plugin* |
7 | 727 |
728 Since the text for this plugin is rather long it has been put in a separate | |
729 file: |pi_spec.txt|. | |
730 | |
731 | |
11229
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
10548
diff
changeset
|
732 RUST *ft-rust* |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
10548
diff
changeset
|
733 |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
10548
diff
changeset
|
734 Since the text for this plugin is rather long it has been put in a separate |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
10548
diff
changeset
|
735 file: |ft_rust.txt|. |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
10548
diff
changeset
|
736 |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
10548
diff
changeset
|
737 |
720 | 738 SQL *ft-sql* |
739 | |
740 Since the text for this plugin is rather long it has been put in a separate | |
1624 | 741 file: |ft_sql.txt|. |
720 | 742 |
743 | |
4681
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2908
diff
changeset
|
744 TEX *ft-tex-plugin* *g:tex_flavor* |
798 | 745 |
746 If the first line of a *.tex file has the form > | |
747 %&<format> | |
748 then this determined the file type: plaintex (for plain TeX), context (for | |
749 ConTeXt), or tex (for LaTeX). Otherwise, the file is searched for keywords to | |
800 | 750 choose context or tex. If no keywords are found, it defaults to plaintex. |
751 You can change the default by defining the variable g:tex_flavor to the format | |
851 | 752 (not the file type) you use most. Use one of these: > |
753 let g:tex_flavor = "plain" | |
754 let g:tex_flavor = "context" | |
755 let g:tex_flavor = "latex" | |
756 Currently no other formats are recognized. | |
798 | 757 |
758 | |
13051 | 759 VIM *ft-vim-plugin* |
760 | |
761 The Vim filetype plugin defines mappings to move to the start and end of | |
762 functions with [[ and ]]. Move around comments with ]" and [". | |
763 | |
764 The mappings can be disabled with: > | |
765 let g:no_vim_maps = 1 | |
766 | |
767 | |
768 ZIMBU *ft-zimbu-plugin* | |
769 | |
770 The Zimbu filetype plugin defines mappings to move to the start and end of | |
771 functions with [[ and ]]. | |
772 | |
773 The mappings can be disabled with: > | |
774 let g:no_zimbu_maps = 1 | |
775 < | |
776 | |
777 | |
14421 | 778 vim:tw=78:ts=8:noet:ft=help:norl: |