Sign in Join
Wiki copytemporary

CudaText files formats: what changed

Revision 3 to 4. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11## Format of auto-completion acp file
22
33Common auto-completion file format is ANSI text file, it contains list of lines in forms:
44
5-`Type Id |Hint`\
6-`Type Id (Param1; Param2; ...) |Hint`\
7-`Type Id (Param1; Param2; ...): ResultType |Hint`
5+``` pascal
6+Type Id |Hint
7+Type Id (Param1; Param2; ...) |Hint
8+Type Id (Param1; Param2; ...): ResultType |Hint
9+```
810
911- Strings "Type", "Id", "Params", "Hint" are shown in separate columns of completion listbox, with separate colors. "Id" is the text which is inserted for a line.
1012- Both ";" and "," chars can be params delimiters. "\|Hint" part is optional.
1113- If "\\" char is present in hint part, then it must be escaped: "\\\\".
1214- If space is needed in id part, it must be written as "%20" (it's allowed for any char in range 0x20..0x2F).
1315
1416First line in the file can be the "control" line: it specifies what chars are "word chars" for the used syntax. For example, if word chars are minus, dot, and \# sign, the control line should be:
1517
16-`#chars .-#`
18+```text
19+#chars .-#
20+```
1721
1822## Format of install.inf files
1923
2024User can open addons in zip files (using "File-Open") and install them. To make such zip file, pack into zip also "install.inf" with meta-info.
2125
2226- "title" field (required)
2327- "desc" field, long text for install prompt dialog
2428- "type" field (required) must be one of:
2529 - cudatext-plugin: to install plugin to subdir of "py" dir
2630 - cudatext-data: to copy any files into subdir of "data" dir
2731 - lexer: to install lexers (zip must be made by SynWrite's ExLexer addon)
2832 - lexer-lite: to install lite lexer
2933
3034- "subdir" field (required)
3135 - for plugins it should begin with prefix "cuda_"
3236 - for lexers it should be "-"
3337- "homepage" field, source code repository URL (usually on GitHub)
3438- "api" field, optional, minimal required API version (3 numbers dot-separated)
3539- "os" field, optional, comma-separated list of supported platforms, described below
3640
3741### Install.inf supported "os" values
3842
3943Value of "os" field is comma-separated list of platforms (no spaces around commas). Each platform is supported OS name, with optional trailing "-" and CPU family name.
4044
4145OS names are:
4246
4347- win
4448- linux
4549- macos
4650- freebsd
4751- openbsd
4852- netbsd
4953- dragonfly
5054- solaris
5155- haiku
5256
5357CPU families are:
5458
5559- i386
5660- x86_64
5761- arm
5862- aarch64
5963- sparc
6064- ppc
6165- ppc64
6266- mips
6367
6468So for example Windows x86 platform values are "win" and "win-i386", Linux AMD64 platform values are "linux" and "linux-x86_64".
6569
6670### Install.inf for plugins
6771
6872Example of install.inf for plugin (plugin adds 2 menu items with menu separator between):
6973
7074``` ini
7175[info]
7276title=MyName
7377desc=Plugin allows smth
7478type=cudatext-plugin
7579subdir=cuda_test
7680homepage=http://github.com/some/name/
7781api=1.0.200
7882
7983[item1]
8084section=commands
8185caption=MyPlugin\Cmd one
8286method=run
8387lexers=CSS,HTML
8488hotkey=Alt+F
8589
8690[item2]
8791section=commands
8892caption=MyPlugin\-
8993method=nnnn
9094
9195[item3]
9296section=commands
9397caption=MyPlugin\Cmd other
9498method=run_more
9599menu=0
96100```
97101
98102Section names: "item" followed by any string (e.g. "item1"). Fields in sections:
99103
100104- "section": possible values are "commands", "events".
101105- "caption": caption of menu item in Plugins menu. "\\" separates menu levels. "&" makes accelerator hotkey. "-" as final level name, makes separator menu item.
102106- "method": Python method name in Command class.
103107- "lexers": comma-separated lexer names, means that command can be run only when such lexer(s) active.
104108- "hotkey": value must be simple hotkey string (e.g. "Alt+F", "Ctrl+Shift+F1") or key combo separated by "\|" (e.g. "Alt+F\|F\|G").
105109 - If "lexers=" param missed, then hotkey saves to file "keys.json" for all lexers.
106110 - If "lexers=" param present, then hotkey saves to "keys lexer NNNN.json" for each mentioned lexer.
107111- "menu": optional. Possible values:
108112 - "" (empty, default): menu item will be put to "Plugins".
109113 - "0": hide menu item.
110114 - "o": menu item will be put to "Options / Settings-plugins".
111115 - "op": menu item will be put both to "Plugins" and "Options / Settings-plugins".
112116
113117Only for "section=events":
114118
115119- "events": comma-separated list of events to handle in plugin, e.g. "events=on_change,on_caret".
116120- "keys": supported only for several events:
117121 - for "on_key": comma-separated list of int key codes to handle in event, e.g. "keys=9" means that event is only called for key code 9 (Tab char).
118122 - for "on_open" / "on_open_pre": comma-separated list of lower-case file extensions, without leading dot, to handle in event.
119123
120124#### Install.inf sidebar buttons
121125
122126CudaText can show plugin's sidebar buttons even without running the plugin in "on_start" event. Plugin should add sections "sidebar*" ("*" means any substring), with the keys:
123127
124128- "hint": Tooltip of button, must be the same as used by plugin to create its button.
125129- "icon": Filename of PNG icon. If path is missed, CudaText uses file from its "data" folder. To specify filename in plugin folder, write value as "{dir}/subdir/filename.png" - with macro {dir}, with forward slashes.
126130- "method": Python method name to show plugin panel. This command should create side panel for this button.
127131
128132Plugin should add sections "bottombar*" ("*" means any substring) to perform the same, but for the bottom part of sidebar, where buttons "Console" and "Output" are placed.
129133
130134#### Install.inf lexer lists
131135
132136If plugin has many \[itemN\] sections, it is possible to set list of lexers using variable (not to write each time "lexers=name,name2,name3"). Declare list of lexers in \[info\] section like this, any variable name:
133137
134138``` ini
135139[info]
136140$var=Name1,Name2,Name3
137141```
138142
139143In \[itemN\] sections set lexers like this:
140144
141145``` ini
142146[itemN]
143147lexers=$var
144148```
145149
146150You can set lexers by reg-ex, e.g. reg-ex ".*SQL.*" means all names with substring "SQL". To do it, write variable with prefix:
147151
148152``` ini
149153[info]
150154$var=regex:.*SQL.*
151155```
152156
153157### Install.inf for data files
154158
155159Example of install.inf for data files, to be copied into subdir of "data" dir. Name of subdir can be any, for example "themes".
156160
157161``` ini
158162[info]
159163title=NiceDarkTheme
160164desc=Nice Dark theme (by AuthorName)
161165type=cudatext-data
162166subdir=themes
163167```
164168
165169### Install.inf for lexers
166170
167171To see example of install.inf for lexers, download any lexer. To see complex example, download lexer zip for "HTML Smarty" which has 2 lexers inside, one lexer is linked to another.
168172
169173``` ini
170174[info]
171175title=HTML Smarty
172176type=lexer
173177subdir=-
174178
175179[lexer1]
176180file=HTML Smarty internal
177181[lexer2]
178182file=HTML Smarty
179183link1=CSS
180184link2=VBScript
181185link3=JavaScript
182186link4=JavaScript
183187link5=VBScript
184188link6=PHP
185189link7=PHP
186190link8=HTML Smarty internal
187191```
188192
189193### Install.inf for lite lexers
190194
191195Example of install.inf for lite lexer. Note that "^" suffix not needed here.
192196
193197``` ini
194198[info]
195199title=MyLexer
196200type=lexer-lite
197201subdir=-
198202```
199203
200204## Format of .cuda-lexops files
201205
202206Files keep lexer styles, which user changed in the "Lexer Properties" dialog. JSON format.
203207
204208Root keys:
205209
206210- "files": str: space-separated list of file masks for lexer. Each mask can be "nnn" for extension .nnn, or "/mmm" for full filename mmm.
207211- "style_NN" for each lexer style name "NN", which user have changed. Subkeys are:
208212 - "font_color": str: color of font, in Pascal format.
209213 - "font_style": str: several chars: "i" for italic, "b" for bold, "s" for strikeout.
210214 - "back": str: color of background, in Pascal format.
211215 - "brd_c_l", "brd_c_r", "brd_c_t", "brd_c_b": str: color of border (left, right, top, bottom), in Pascal format.
212216 - "brd_t_l", "brd_t_r", "brd_t_t", "brd_t_b": int: type of border (left, right, top, bottom). Values 0..9: None, Solid, Dash, Dot, DashDot, DashDotDot, Solid2, Solid3, WavyLine, Double.
213217
214218Color in Pascal format: hex number (6..8 digits) with "\$" prefix, or constants. See possible constants (with hex values) in Lazarus file Graphics.pp, where string 'clBlack' is defined. <https://gitlab.com/freepascal.org/lazarus/lazarus/-/blob/main/lcl/graphics.pp>
215219
216220---
217221*From the Free Pascal wiki, page "CudaText files formats", as it stood on 2022-08-16 after a change by Alextp, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
218222Category: CudaText

Back to history