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