Format of install.inf files
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.
- "title" field (required)
- "desc" field, long text for install prompt dialog
- "type" field (required) must be one of:
- cudatext-plugin: to install plugin to subdir of "py" dir
- cudatext-data: to copy any files into subdir of "data" dir
- lexer: to install lexers (zip must be made by SynWrite's ExLexer addon)
- lexer-lite: to install lite lexer
- "subdir" field (required)
- for plugins it should begin with prefix "cuda_"
- for lexers it should be "-"
- "homepage" field, source code repository URL (usually on GitHub)
- "api" field, optional, minimal required API version (3 numbers dot-separated)
- "os" field, optional, comma-separated list of supported platforms:
- "win", with optional CPU suffix
- "linux", with optional CPU suffix
- "macos"
- "freebsd", with optional CPU suffix
- "openbsd", with optional CPU suffix
- "netbsd", with optional CPU suffix
- "dragonfly", with optional CPU suffix
- "solaris", with optional CPU suffix
CPU suffix is "-" char followed by names: i386, x86_64, arm, aarch64, sparc. So for example Linux/x86 allows values "linux" and "linux-i386", Solaris/AMD64 allows values "solaris" and "solaris-x86_64".
Plugins
Example of install.inf for plugin (plugin adds 2 menu items with menu separator between):
- [info]
- title=MyName
- desc=Plugin allows smth
- type=cudatext-plugin
- subdir=cuda_test
- homepage=http://github.com/some/name/
- api=1.0.200
- [item1]
- section=commands
- caption=MyPlugin\Cmd one
- method=run
- lexers=CSS,HTML
- hotkey=Alt+F
- [item2]
- section=commands
- caption=MyPlugin\-
- method=nnnn
- [item3]
- section=commands
- caption=MyPlugin\Cmd other
- method=run_more
- menu=0
Section names: from "item1" to "item400", any numbers can be skipped. Fields in "item" sections:
- "section": possible values are "commands", "events".
- "caption": caption of menu item in Plugins menu. "\" separates menu levels. "&" makes accelerator hotkey. "-" as final level name, makes separator menu item.
- "method": Python method name in Command class.
- "lexers": comma-separated lexer names, means that command can be run only when such lexer(s) active.
- "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").
- If "lexers=" param missed, then hotkey saves to file "keys.json" for all lexers.
- If "lexers=" param present, then hotkey saves to "keys lexer NNNN.json" for each mentioned lexer.
- "menu": optional. Possible values:
- "" (empty, default): menu item will be put to "Plugins".
- "0": hide menu item.
- "o": menu item will be put to "Options / Settings-plugins".
- "op": menu item will be put both to "Plugins" and "Options / Settings-plugins".
Only for "section=events":
- "events": comma-separated list of events to handle in plugin, e.g. "events=on_change,on_caret".
- "keys": only for plugin which handles "on_key": comma-separated list of int key codes to handle in "on_key", e.g. "keys=9" means that "on_key" is only called for key code 9 (tab char).
Plugin can show sidebar button(s), without running plugin code. For this, add sections "sidebar1" to "sidebar3", with keys:
- "hint": hint of button, must be the same as used by plugin to create button in runtime.
- "icon": filename of PNG icon. If path missed, used file from CudaText. To use path in plugin dir, write value as "{dir}/subdir/filename.png" - with macro, with / slashes.
- "method": Python method name to show plugin side panel. This command must create side panel for this sidebar button.
Lexer lists
If plugin has many [itemN] sections, it is possible to set list of lexers using vairable (not to write each time "lexers=name,name2,name3"). Declare list of lexers in [info] section like this, any variable name:
- [info]
- $var=Name1,Name2,Name3
In [itemN] sections set lexers like this:
- [itemN]
- lexers=$var
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:
- [info]
- $var=regex:.*SQL.*
Data-files
Example of install.inf for data files, to be copied into subdir of "data" dir. Name of subdir can be any, for example "themes".
- [info]
- title=NiceDarkTheme
- desc=Nice Dark theme (by AuthorName)
- type=cudatext-data
- subdir=themes
Lexers
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.
- [info]
- title=HTML Smarty
- type=lexer
- subdir=-
- [lexer1]
- file=HTML Smarty internal
- [lexer2]
- file=HTML Smarty
- link1=CSS
- link2=VBScript
- link3=JavaScript
- link4=JavaScript
- link5=VBScript
- link6=PHP
- link7=PHP
- link8=HTML Smarty internal
Lite lexers
Example of install.inf for lite lexer. Note that "^" suffix not needed here.
- [info]
- title=MyLexer
- type=lexer-lite
- subdir=-