CudaText files formats: what changed
Revision 3 to 4. Removed lines have a minus sign; added lines have a plus sign.
| Old | New | Line | |
|---|---|---|---|
| 1 | 1 | ## Format of auto-completion acp file | |
| 2 | 2 | ||
| 3 | 3 | Common auto-completion file format is ANSI text file, it contains list of lines in forms: | |
| 4 | 4 | ||
| 5 | - | ||
| 6 | - | ||
| 7 | - | ||
| 5 | + | ``` pascal | |
| 6 | + | Type Id |Hint | |
| 7 | + | Type Id (Param1; Param2; ...) |Hint | |
| 8 | + | Type Id (Param1; Param2; ...): ResultType |Hint | |
| 9 | + | ``` | |
| 8 | 10 | ||
| 9 | 11 | - 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. | |
| 10 | 12 | - Both ";" and "," chars can be params delimiters. "\|Hint" part is optional. | |
| 11 | 13 | - If "\\" char is present in hint part, then it must be escaped: "\\\\". | |
| 12 | 14 | - If space is needed in id part, it must be written as "%20" (it's allowed for any char in range 0x20..0x2F). | |
| 13 | 15 | ||
| 14 | 16 | First 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: | |
| 15 | 17 | ||
| 16 | - | ||
| 18 | + | ```text | |
| 19 | + | #chars .-# | |
| 20 | + | ``` | |
| 17 | 21 | ||
| 18 | 22 | ## Format of install.inf files | |
| 19 | 23 | ||
| 20 | 24 | User 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. | |
| 21 | 25 | ||
| 22 | 26 | - "title" field (required) | |
| 23 | 27 | - "desc" field, long text for install prompt dialog | |
| 24 | 28 | - "type" field (required) must be one of: | |
| 25 | 29 | - cudatext-plugin: to install plugin to subdir of "py" dir | |
| 26 | 30 | - cudatext-data: to copy any files into subdir of "data" dir | |
| 27 | 31 | - lexer: to install lexers (zip must be made by SynWrite's ExLexer addon) | |
| 28 | 32 | - lexer-lite: to install lite lexer | |
| 29 | 33 | ||
| 30 | 34 | - "subdir" field (required) | |
| 31 | 35 | - for plugins it should begin with prefix "cuda_" | |
| 32 | 36 | - for lexers it should be "-" | |
| 33 | 37 | - "homepage" field, source code repository URL (usually on GitHub) | |
| 34 | 38 | - "api" field, optional, minimal required API version (3 numbers dot-separated) | |
| 35 | 39 | - "os" field, optional, comma-separated list of supported platforms, described below | |
| 36 | 40 | ||
| 37 | 41 | ### Install.inf supported "os" values | |
| 38 | 42 | ||
| 39 | 43 | Value 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. | |
| 40 | 44 | ||
| 41 | 45 | OS names are: | |
| 42 | 46 | ||
| 43 | 47 | - win | |
| 44 | 48 | - linux | |
| 45 | 49 | - macos | |
| 46 | 50 | - freebsd | |
| 47 | 51 | - openbsd | |
| 48 | 52 | - netbsd | |
| 49 | 53 | - dragonfly | |
| 50 | 54 | - solaris | |
| 51 | 55 | - haiku | |
| 52 | 56 | ||
| 53 | 57 | CPU families are: | |
| 54 | 58 | ||
| 55 | 59 | - i386 | |
| 56 | 60 | - x86_64 | |
| 57 | 61 | - arm | |
| 58 | 62 | - aarch64 | |
| 59 | 63 | - sparc | |
| 60 | 64 | - ppc | |
| 61 | 65 | - ppc64 | |
| 62 | 66 | - mips | |
| 63 | 67 | ||
| 64 | 68 | So for example Windows x86 platform values are "win" and "win-i386", Linux AMD64 platform values are "linux" and "linux-x86_64". | |
| 65 | 69 | ||
| 66 | 70 | ### Install.inf for plugins | |
| 67 | 71 | ||
| 68 | 72 | Example of install.inf for plugin (plugin adds 2 menu items with menu separator between): | |
| 69 | 73 | ||
| 70 | 74 | ``` ini | |
| 71 | 75 | [info] | |
| 72 | 76 | title=MyName | |
| 73 | 77 | desc=Plugin allows smth | |
| 74 | 78 | type=cudatext-plugin | |
| 75 | 79 | subdir=cuda_test | |
| 76 | 80 | homepage=http://github.com/some/name/ | |
| 77 | 81 | api=1.0.200 | |
| 78 | 82 | ||
| 79 | 83 | [item1] | |
| 80 | 84 | section=commands | |
| 81 | 85 | caption=MyPlugin\Cmd one | |
| 82 | 86 | method=run | |
| 83 | 87 | lexers=CSS,HTML | |
| 84 | 88 | hotkey=Alt+F | |
| 85 | 89 | ||
| 86 | 90 | [item2] | |
| 87 | 91 | section=commands | |
| 88 | 92 | caption=MyPlugin\- | |
| 89 | 93 | method=nnnn | |
| 90 | 94 | ||
| 91 | 95 | [item3] | |
| 92 | 96 | section=commands | |
| 93 | 97 | caption=MyPlugin\Cmd other | |
| 94 | 98 | method=run_more | |
| 95 | 99 | menu=0 | |
| 96 | 100 | ``` | |
| 97 | 101 | ||
| 98 | 102 | Section names: "item" followed by any string (e.g. "item1"). Fields in sections: | |
| 99 | 103 | ||
| 100 | 104 | - "section": possible values are "commands", "events". | |
| 101 | 105 | - "caption": caption of menu item in Plugins menu. "\\" separates menu levels. "&" makes accelerator hotkey. "-" as final level name, makes separator menu item. | |
| 102 | 106 | - "method": Python method name in Command class. | |
| 103 | 107 | - "lexers": comma-separated lexer names, means that command can be run only when such lexer(s) active. | |
| 104 | 108 | - "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"). | |
| 105 | 109 | - If "lexers=" param missed, then hotkey saves to file "keys.json" for all lexers. | |
| 106 | 110 | - If "lexers=" param present, then hotkey saves to "keys lexer NNNN.json" for each mentioned lexer. | |
| 107 | 111 | - "menu": optional. Possible values: | |
| 108 | 112 | - "" (empty, default): menu item will be put to "Plugins". | |
| 109 | 113 | - "0": hide menu item. | |
| 110 | 114 | - "o": menu item will be put to "Options / Settings-plugins". | |
| 111 | 115 | - "op": menu item will be put both to "Plugins" and "Options / Settings-plugins". | |
| 112 | 116 | ||
| 113 | 117 | Only for "section=events": | |
| 114 | 118 | ||
| 115 | 119 | - "events": comma-separated list of events to handle in plugin, e.g. "events=on_change,on_caret". | |
| 116 | 120 | - "keys": supported only for several events: | |
| 117 | 121 | - 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). | |
| 118 | 122 | - for "on_open" / "on_open_pre": comma-separated list of lower-case file extensions, without leading dot, to handle in event. | |
| 119 | 123 | ||
| 120 | 124 | #### Install.inf sidebar buttons | |
| 121 | 125 | ||
| 122 | 126 | CudaText 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: | |
| 123 | 127 | ||
| 124 | 128 | - "hint": Tooltip of button, must be the same as used by plugin to create its button. | |
| 125 | 129 | - "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. | |
| 126 | 130 | - "method": Python method name to show plugin panel. This command should create side panel for this button. | |
| 127 | 131 | ||
| 128 | 132 | Plugin 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. | |
| 129 | 133 | ||
| 130 | 134 | #### Install.inf lexer lists | |
| 131 | 135 | ||
| 132 | 136 | If 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: | |
| 133 | 137 | ||
| 134 | 138 | ``` ini | |
| 135 | 139 | [info] | |
| 136 | 140 | $var=Name1,Name2,Name3 | |
| 137 | 141 | ``` | |
| 138 | 142 | ||
| 139 | 143 | In \[itemN\] sections set lexers like this: | |
| 140 | 144 | ||
| 141 | 145 | ``` ini | |
| 142 | 146 | [itemN] | |
| 143 | 147 | lexers=$var | |
| 144 | 148 | ``` | |
| 145 | 149 | ||
| 146 | 150 | You can set lexers by reg-ex, e.g. reg-ex ".*SQL.*" means all names with substring "SQL". To do it, write variable with prefix: | |
| 147 | 151 | ||
| 148 | 152 | ``` ini | |
| 149 | 153 | [info] | |
| 150 | 154 | $var=regex:.*SQL.* | |
| 151 | 155 | ``` | |
| 152 | 156 | ||
| 153 | 157 | ### Install.inf for data files | |
| 154 | 158 | ||
| 155 | 159 | Example of install.inf for data files, to be copied into subdir of "data" dir. Name of subdir can be any, for example "themes". | |
| 156 | 160 | ||
| 157 | 161 | ``` ini | |
| 158 | 162 | [info] | |
| 159 | 163 | title=NiceDarkTheme | |
| 160 | 164 | desc=Nice Dark theme (by AuthorName) | |
| 161 | 165 | type=cudatext-data | |
| 162 | 166 | subdir=themes | |
| 163 | 167 | ``` | |
| 164 | 168 | ||
| 165 | 169 | ### Install.inf for lexers | |
| 166 | 170 | ||
| 167 | 171 | To 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. | |
| 168 | 172 | ||
| 169 | 173 | ``` ini | |
| 170 | 174 | [info] | |
| 171 | 175 | title=HTML Smarty | |
| 172 | 176 | type=lexer | |
| 173 | 177 | subdir=- | |
| 174 | 178 | ||
| 175 | 179 | [lexer1] | |
| 176 | 180 | file=HTML Smarty internal | |
| 177 | 181 | [lexer2] | |
| 178 | 182 | file=HTML Smarty | |
| 179 | 183 | link1=CSS | |
| 180 | 184 | link2=VBScript | |
| 181 | 185 | link3=JavaScript | |
| 182 | 186 | link4=JavaScript | |
| 183 | 187 | link5=VBScript | |
| 184 | 188 | link6=PHP | |
| 185 | 189 | link7=PHP | |
| 186 | 190 | link8=HTML Smarty internal | |
| 187 | 191 | ``` | |
| 188 | 192 | ||
| 189 | 193 | ### Install.inf for lite lexers | |
| 190 | 194 | ||
| 191 | 195 | Example of install.inf for lite lexer. Note that "^" suffix not needed here. | |
| 192 | 196 | ||
| 193 | 197 | ``` ini | |
| 194 | 198 | [info] | |
| 195 | 199 | title=MyLexer | |
| 196 | 200 | type=lexer-lite | |
| 197 | 201 | subdir=- | |
| 198 | 202 | ``` | |
| 199 | 203 | ||
| 200 | 204 | ## Format of .cuda-lexops files | |
| 201 | 205 | ||
| 202 | 206 | Files keep lexer styles, which user changed in the "Lexer Properties" dialog. JSON format. | |
| 203 | 207 | ||
| 204 | 208 | Root keys: | |
| 205 | 209 | ||
| 206 | 210 | - "files": str: space-separated list of file masks for lexer. Each mask can be "nnn" for extension .nnn, or "/mmm" for full filename mmm. | |
| 207 | 211 | - "style_NN" for each lexer style name "NN", which user have changed. Subkeys are: | |
| 208 | 212 | - "font_color": str: color of font, in Pascal format. | |
| 209 | 213 | - "font_style": str: several chars: "i" for italic, "b" for bold, "s" for strikeout. | |
| 210 | 214 | - "back": str: color of background, in Pascal format. | |
| 211 | 215 | - "brd_c_l", "brd_c_r", "brd_c_t", "brd_c_b": str: color of border (left, right, top, bottom), in Pascal format. | |
| 212 | 216 | - "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. | |
| 213 | 217 | ||
| 214 | 218 | Color 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> | |
| 215 | 219 | ||
| 216 | 220 | --- | |
| 217 | 221 | *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).* | |
| 218 | 222 | Category: CudaText |
