annotate runtime/doc/ft_context.txt @ 31135:759b181807f7 v9.0.0902

patch 9.0.0902: some mouse scroll code is not in a good place Commit: https://github.com/vim/vim/commit/696d0a86250636602d42e29e57d8923f538e0549 Author: Christopher Plewright <chris@createng.com> Date: Fri Nov 18 17:53:34 2022 +0000 patch 9.0.0902: some mouse scroll code is not in a good place Problem: Some mouse scroll code is not in a good place. Solution: Refactor the code. (Christopher Plewright, closes https://github.com/vim/vim/issues/11561)
author Bram Moolenaar <Bram@vim.org>
date Fri, 18 Nov 2022 19:00:05 +0100
parents 1e91e26ceebf
children a7801222c9c5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
30547
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29885
diff changeset
1 *ft_context.txt* For Vim version 9.0. Last change: 2022 Sep 27
29885
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3 This is the documentation for the ConTeXt filetype plugin.
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
4
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
5 NOTE: the plugin requires +vim9script.
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7 ==============================================================================
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8 CONTENTS *context.vim* *ft-context*
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10 1. Introduction |ft-context-intro|
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11 2. Commands |ft-context-commands|
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
12 3. Settings |ft-context-settings|
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
13 4. Mappings |ft-context-mappings|
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15 ==============================================================================
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16 *ft-context-intro*
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17 Introduction ~
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19 ConTeXt, similarly to LaTeX, is a macro-based typesetting system built on TeX:
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20 >
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
21 https://wiki.contextgarden.net
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22 https://wiki.contextgarden.net/Vim
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
23 <
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
24 The ConTeXt plugin provides syntax highlighting, completion and support for
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
25 typesetting ConTeXt documents. The recommended way to typeset a document is to
30547
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29885
diff changeset
26 use |:ConTeXt|. This will invoke the `mtxrun` script that is found in `$PATH`.
29885
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
27
30547
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29885
diff changeset
28 For more fine grained control over the command and its environment,
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29885
diff changeset
29 `context.Typeset()` can be used directly (or `context#Typeset()` from legacy
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29885
diff changeset
30 Vim script). For instance, if a version of ConTeXt is installed in
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29885
diff changeset
31 `~/context`, you may define a function to use it similar to the following:
29885
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
32 >
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
33 import autoload 'context.vim'
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
34
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
35 def MyConTeXt()
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
36 const env = {'PATH':
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37 printf("%s/context/tex/texmf-<os>-<arch>/bin:%s", $HOME, $PATH)}
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
38 context.Typeset("%", env)
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
39 enddef
30547
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29885
diff changeset
40
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29885
diff changeset
41 This code may go in `~/.vim/after/ftplugin/context.vim`. A mapping can then be
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29885
diff changeset
42 defined to invoke the custom command:
29885
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
43 >
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
44 nnoremap <silent><buffer><leader>t <scriptcmd>MyConTeXt()<cr>
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
45 <
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
46 `context.Typeset()` accepts a third optional argument to specify a custom
30547
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29885
diff changeset
47 typesetting command. That must be a function that takes a path and returns the
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29885
diff changeset
48 command as a List. For example:
29885
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
49 >
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
50 def ConTeXtCustomCommand(path: string): list<string>
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
51 return ['mtxrun', '--script', 'context', '--nonstopmode, path]
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
52 enddef
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
53
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
54 context.ConTeXtTypeset("%", v:none, ConTeXtCustomCommand)
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
55 <
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
56 Large projects are often organized as a root document and various chapter
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
57 files. When editing a chapter file, it is convenient to invoke |:ConTeXt|
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
58 directly on it, rather than having to switch to the root file. A "magic line"
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
59 can be added at the beginning of each chapter file, which specifies the
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
60 relative path to the root file. For instance:
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
61 >
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
62 % !TEX root = ../MyRoot.tex
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
63 <
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
64 Vim searches for the magic line in the first ten lines of the current buffer:
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
65 if it is found, the document specified by that line is typeset rather than the
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
66 one in the current buffer. The root document does not have to be opened in
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
67 Vim.
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
68
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
69 To extend completion and syntax highlighting, you may generate supporting
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
70 files using ConTeXt and add them to your configuration. If you configuration
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
71 resides in `~/.vim`, you may use these commands:
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
72 >
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
73 mkdir -p ~/.vim/syntax/shared
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
74 cd ~/.vim/syntax/shared
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
75 mtxrun --script interface --vim
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
76 <
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
77 The last command will create the following syntax files:
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
78
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
79 - `context-data-context.vim`;
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
80 - `context-data-interfaces.vim`;
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
81 - `context-data-metafun.vim`;
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
82 - `context-data-tex.vim`.
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
83
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
84 The same command can be used to update those syntax files.
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
85
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
86 *ft-context-commands*
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
87 Commands ~
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
88 *:ConTeXt*
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
89 Start a background |job| to typeset the document in the current buffer. The
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
90 command accepts an optional buffer's name, if you want to typeset a document
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
91 that is in a different buffer.
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
92
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
93 *:ConTeXtLog*
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
94 Edit the log file corresponding to the source in the current buffer.
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
95
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
96 *:ConTeXtJobsStatus*
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
97 Echo the number of jobs currently running in the background.
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
98
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
99 *:ConTeXtStopJobs*
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
100 Stop all the ConTeXt jobs currently running in the background.
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
101
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
102 *ft-context-settings*
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
103 Settings ~
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
104 *'b:context_ignore_makefile'*
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
105 *'g:context_ignore_makefile'*
30547
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29885
diff changeset
106 `:make` can be used to (synchronously) typeset a document. If a Makefile exists
29885
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
107 and this option is not set, standard `make` is used. If this option is set,
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
108 `mtxrun` is invoked instead, even if a Makefile exists.
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
109 >
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
110 g:context_ignore_makefile = 0
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
111 <
30547
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29885
diff changeset
112 NOTE: before using `:make`, set the working directory of the buffer to the
29885
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
113 directory of the file to be typeset.
30547
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29885
diff changeset
114
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29885
diff changeset
115 *'g:context_extra_options'*
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29885
diff changeset
116 A list of additional options to pass to `mtxrun`.
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29885
diff changeset
117 >
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29885
diff changeset
118 g:context_extra_options = []
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29885
diff changeset
119 <
29885
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
120 *'b:context_include'*
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
121 *'g:context_include'*
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
122 Dictionary of filetype/GROUP pairs for which syntax highlighting should be
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
123 activated between \startGROUP and \stopGROUP. The default is to highlight XML
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
124 between `\startXML` and `\stopXML`.
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
125 >
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
126 g:context_include = {'xml': 'XML'}
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
127
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
128 NOTE: Lua and MetaPost are always highlighted within the respective blocks.
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
129
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
130 *'g:no_context_maps'*
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
131 When set, do not define any mappings.
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
132 >
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
133 g:no_context_maps = 0
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
134 <
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
135 *ft-context-mappings*
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
136 Mappings ~
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
137
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
138 tp "reflow TeX paragraph".
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
139
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
140 i$ "inside inline math block".
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
141
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
142 a$ "around inline math block".
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
143
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
144 ]] [count] start of sections forward.
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
145
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
146 [[ [count] start of sections backward.
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
147
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
148 ][ [count] end sections forward.
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
149
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
150 [] [count] end of sections backward.
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
151
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
152 ]} [count] end of blocks (\stop..., \setup...,
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
153 \define...) forward.
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
154
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
155 [{ [count] begin of blocks (\start..., \setup...,
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
156 \define...) backward.
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
157
f00c56ee8118 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
158 vim:tw=78:sw=4:ts=8:noet:ft=help:norl: