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