ft_mp.txt 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. *ft_mp.txt* For Vim version 9.0. Last change: 2022 Aug 12
  2. This is the documentation for the METAFONT and MetaPost filetype plugins.
  3. Unless otherwise specified, the commands, settings and mappings defined below
  4. apply equally to both filetypes.
  5. NOTE: the plugin requires +vim9script.
  6. ==============================================================================
  7. CONTENTS *mp.vim* *ft-metapost*
  8. *mf.vim* *ft-metafont*
  9. 1. Introduction |ft-metapost-intro|
  10. 2. Commands |ft-metapost-commands|
  11. 3. Settings |ft-metapost-settings|
  12. 4. Mappings |ft-metapost-mappings|
  13. ==============================================================================
  14. *ft-metapost-intro*
  15. *ft-metafont-intro*
  16. Introduction ~
  17. This filetype plugin provides extensive support for editing METAFONT and
  18. MetaPost documents, including syntax coloring, indentation, and completion.
  19. Defining indentation rules for METAFONT and MetaPost code is tricky and
  20. somewhat subjective, because the syntax is quite liberal. The plugin uses some
  21. heuristics that work well most of the time, but in particular cases you may
  22. want to to override the automatic rules, so that the manually defined
  23. indentation is preserved by commands like `gg=G`.
  24. This can be achieved by appending `%>`, `%<`, `%=` or `%!` to a line to
  25. explicitly control the indentation of the next line. The `<` and `>` symbols
  26. may be repeated many times: for instance, `%>>` will cause the next line to be
  27. indented twice. Of course, `%<` means that the next line should be
  28. de-indented; `%=` sets the indentation of the next line to be equal to the
  29. indentation of the current line; and `%!` means that the indentation of the
  30. next line should not change from whatever it has been manually set.
  31. For example, this is the default indentation of a simple macro:
  32. >
  33. def foo =
  34. makepen(
  35. subpath(T-n,t) of r
  36. shifted .5down
  37. --subpath(t,T) of r shifted .5up -- cycle
  38. )
  39. withcolor black
  40. enddef
  41. <
  42. By adding the special comments, the indentation can be adjusted arbitrarily:
  43. >
  44. def foo =
  45. makepen(
  46. subpath(T-n,t) of r %>
  47. shifted .5down %>
  48. --subpath(t,T) of r shifted .5up -- cycle %<<<
  49. )
  50. withcolor black
  51. enddef
  52. <
  53. *ft-metapost-commands*
  54. Commands ~
  55. *:FixBeginfigs*
  56. Renumber beginfig() blocks in the current buffer so that the n-th figure has
  57. number n. MetaPost only.
  58. *ft-metapost-settings*
  59. *ft-metafont-settings*
  60. Settings ~
  61. *'g:mf_other_macros'*
  62. Highlight some other basic macro names, e.g., from cmbase, logo, etc. This is
  63. set to 1 by default in METAFONT buffers, and it is set to 0 by default in
  64. MetaPost buffers.
  65. *'g:mf_plain_macros'*
  66. Highlight keywords defined by plain.mf. This is set to 1 by default in
  67. METAFONT buffers, and it is set to 0 by default in MetaPost buffers.
  68. *'g:mf_plain_modes'*
  69. Highlight keywords defined by modes.mf. This is set to 1 by default in
  70. METAFONT buffers, and it is set to 0 by default in MetaPost buffers.
  71. *'g:mp_close_tag'*
  72. Define additional keywords that end indented blocks. For instance, if you
  73. define:
  74. >
  75. g:mp_end_tag = ['\<endfoo\>']
  76. <
  77. any line starting with `endfoo` will be de-indented compared to its previous
  78. line.
  79. >
  80. g:mp_close_tag = []
  81. <
  82. *'b:mp_metafun'*
  83. *'g:mp_metafun'*
  84. If set to 1, highlight ConTeXt's MetaFun keywords. MetaPost only.
  85. >
  86. g:mp_metafun = 0
  87. <
  88. *'g:mp_mfplain_macros'*
  89. Highlight keywords defined by mfplain.mp. MetaPost only.
  90. >
  91. g:mp_mfplain_macros = 1
  92. <
  93. *'g:mp_open_tag'*
  94. Define additional keywords that start indented blocks. For instance, if you
  95. define:
  96. >
  97. g:mp_open_tag = ['\<beginfoo\>']
  98. <
  99. the line following `beginfoo` will be indented.
  100. >
  101. g:mp_open_tag = []
  102. <
  103. *'g:mp_other_macros'*
  104. Highlight keywords defined by all base macro packages (boxes, rboxes, format,
  105. graph, marith, sarith, string, TEX). This option affects only MetaPost
  106. buffers.
  107. >
  108. g:mp_other_macros = 1
  109. <
  110. *'g:mp_plain_macros'*
  111. Highlight keywords defined by plain.mp. MetaPost only.
  112. >
  113. g:mp_plain_macros = 1
  114. <
  115. *'g:no_mp_maps'*
  116. *'g:no_mf_maps'*
  117. When set, do not define any mapping in buffers with the corresponding
  118. filetype.
  119. >
  120. g:no_mp_maps = 0
  121. g:no_mf_maps = 0
  122. <
  123. *ft-metapost-mappings*
  124. *ft-metafont-mappings*
  125. Mappings ~
  126. ]] [count] vardefs, macros or figures forward.
  127. [[ [count] vardefs, macros or figures backward.
  128. ][ [count] end of vardefs, macros or figures forward.
  129. [] [count] end of vardefs, macros or figures backward.
  130. ]} [count] end of blocks (fi, endfor, endgroup) forward.
  131. [{ [count] begin of blocks (if, for, begingroup) backward.
  132. vim:tw=78:sw=4:ts=8:noet:ft=help:norl: