1- *ft_context.txt* For Vim version 9.1 . Last change: 2024 Jan 01
1+ *ft_context.txt* For Vim version 9.2 . Last change: 2026 Jan 10
22
33This is the documentation for the ConTeXt filetype plugin.
44
5- NOTE: the plugin requires +vim9script.
5+ NOTE: the plugin requires | +vim9script | .
66
77==============================================================================
88CONTENTS *context.vim* *ft-context*
@@ -19,11 +19,11 @@ Introduction ~
1919ConTeXt, similarly to LaTeX, is a macro-based typesetting system built on TeX:
2020>
2121 https://wiki.contextgarden.net
22- https://wiki.contextgarden.net/Vim
22+ https://wiki.contextgarden.net/Input_and_compilation/Text_editors/ Vim
2323<
2424The ConTeXt plugin provides syntax highlighting, completion and support for
2525typesetting ConTeXt documents. The recommended way to typeset a document is to
26- use | :ConTeXt | . This will invoke the `mtxrun` script that is found in ` $PATH ` .
26+ use | :ConTeXt | , which invokes the `mtxrun` script that is found in $PATH.
2727
2828For more fine grained control over the command and its environment,
2929`context.Typeset ()` can be used directly (or `context#Typeset ()` from legacy
@@ -32,26 +32,31 @@ Vim script). For instance, if a version of ConTeXt is installed in
3232>
3333 import autoload 'context.vim'
3434
35+ var os = "linux" # Update to match your system
36+ var arch = "arm64" # Update to match your system
37+
3538 def MyConTeXt()
36- const env = {'PATH':
37- printf("%s/context/tex/texmf-<os>-<arch>/bin:%s", $HOME, $PATH)}
38- context.Typeset("%", env)
39+ var env = {
40+ 'PATH': $'{$HOME}/context/tex/texmf-{os}-{arch}/bin:{$PATH}'
41+ }
42+ context.Typeset("%", env)
3943 enddef
4044
41- This code may go in `~/.vim/after/ftplugin/context.vim ` . A mapping can then be
42- defined to invoke the custom command:
43- >
4445 nnoremap <silent><buffer><leader>t <scriptcmd>MyConTeXt()<cr>
4546<
47+ This code should go in `~/.vim/after/ftplugin/context.vim ` .
48+
4649`context.Typeset ()` accepts a third optional argument to specify a custom
4750typesetting command. That must be a function that takes a path and returns the
48- command as a List . For example:
51+ command as a | list | . For example:
4952>
5053 def ConTeXtCustomCommand(path: string): list<string>
5154 return ['mtxrun', '--script', 'context', '--nonstopmode', path]
5255 enddef
5356
54- context.ConTeXtTypeset("%", v:none, ConTeXtCustomCommand)
57+ def MyContext()
58+ context.Typeset("%", v:none, ConTeXtCustomCommand)
59+ enddef
5560<
5661Large projects are often organized as a root document and various chapter
5762files. When editing a chapter file, it is convenient to invoke | :ConTeXt |
@@ -67,7 +72,7 @@ one in the current buffer. The root document does not have to be opened in
6772Vim.
6873
6974To extend completion and syntax highlighting, you may generate supporting
70- files using ConTeXt and add them to your configuration. If you configuration
75+ files using ConTeXt and add them to your configuration. If your configuration
7176resides in `~/.vim ` , you may use these commands:
7277>
7378 mkdir -p ~/.vim/syntax/shared
@@ -81,7 +86,8 @@ The last command will create the following syntax files:
8186- `context- data- metafun.vim ` ;
8287- `context- data- tex.vim ` .
8388
84- The same command can be used to update those syntax files.
89+ If present, such files will be automatically loaded to enhance syntax
90+ highlighting. The same command can be used to update those syntax files.
8591
8692 *ft-context-commands*
8793Commands ~
@@ -109,8 +115,9 @@ and this option is not set, standard `make` is used. If this option is set,
109115>
110116 g:context_ignore_makefile = 0
111117<
112- NOTE: before using | :make | , set the working directory of the buffer to the
113- directory of the file to be typeset.
118+ NOTE: before using | :make | , ensure that the working directory of the buffer is
119+ set to the directory of the file you want to typeset. Additionally, be aware
120+ that | :make | searches for `mtxrun in $PATH.
114121
115122 *'g:context_extra_options'*
116123A list of additional options to pass to `mtxrun` .
@@ -135,11 +142,11 @@ When set, do not define any mappings.
135142 *ft-context-mappings*
136143Mappings ~
137144
138- tp "reflow TeX paragraph".
145+ tp "reflow TeX paragraph" (motion) .
139146
140- i$ "inside inline math block".
147+ i$ "inside inline math block" (text object selection) .
141148
142- a$ "around inline math block".
149+ a$ "around inline math block" (text object selection) .
143150
144151]] [count] start of sections forward.
145152
0 commit comments