filetype.txt 28 KB

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