Sign in Join
Wiki copytemporary

CudaText: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11CudaText documentation subpages [[CudaText API|API]] | [[CudaText VS other editors|Comparisons with other text editors]] | [[CudaText plugins|Plugins]] | [[CudaText/LSP Client|LSP Client]] | [[CudaText files formats|Supported file formats]]
22---|---|---|---|---
33External Links | [project homepage](<https://cudatext.github.io/>) | [_downloads_](<https://sourceforge.net/projects/cudatext/files/release/>) | [github repository](<https://github.com/Alexey-T/CudaText>) | [_other required lazarus packages_](<https://github.com/Alexey-T>)
44---|---|---|---|---
55
66**CudaText** is a cross-platform text editor, written in Object Pascal language using the Lazarus IDE, with a focus on performance and a broad featureset, which includes:
77
88 * Syntax highlighting for 300+ languages
99 * Multi-carets, multi-selections
1010 * Code folding
1111 * Code-tree (list of functions/classes/etc., if lexer-supported)
1212 * Search/replace with regular expressions
1313
1414 * Command palette
1515 * Configuration files in JSON
1616 * Interface- and syntax-themes
1717 * Support for many encodings
1818 * Based on the [[ATSynEdit]] engine
1919 * Extensibility via Python add-ons, e.g. [LSP](<http://www.wikipedia.org/wiki/Language_Server_Protocol> "wikipedia:Language Server Protocol") support
2020
2121 * Built-in HTML and CSS auto-completion
2222 * HTML tag completion with `⭾ Tab`
2323 * HTML tooltips on mouse-over
2424 * Hex color code underlining
2525 * Viewer for picture files (jpeg, png, gif, bmp, ico, webp)
2626
2727[![CudaText UI Elements](/wiki-images/b/ba/cudatext-ui-elements.png)](</File:cudatext-ui-elements.png> "CudaText UI Elements")
2828
29-ed
30- Main editor field.
31-gut
32- Gutter, contains several columns for the active editor: bookmark icons, line numbers, folding icons, line-state marks.
33-tabs
34- UI-tabs, to switch between different documents.
35-map
36- Mini-map (left side), which is shown here together with micro-map (thin bar on the right side).
37-tree
38- Code-tree, shows 'symbols' from the active document (functions, classes, structs etc) in the tree view.
39-filt
40- Filtering input field for the code-tree. Leaves only those items which contain entered text.
41-
42-tb
43- Toolbar: buttons for some commands. Hidden by default. Configurable via plugin Config Toolbar.
44-sb
45- Sidebar. Vertical bar with buttons to activate different parts of the **side panel** : Code-Tree (built-in), Project Manager (plugin), Snippet Panel (plugin) etc. Sidebar buttons on the bottom half activate parts of the **bottom (horizontal) panel** : Console panel, Output panel etc. Plugins can add buttons to sidebar, for example the bottom black icon is the ExTerminal plugin.
46-cons
47- Console. One of the bottom panels. You can activate others (Output and Validate panels) via sidebar.
48-stat
49- Statusbar. Has several cells to show some current states.
50-bre
51- Breadcrumb bar, clickable filepath entries provided by an optional [plugin](<https://github.com/CudaText-addons/cuda_breadcrumbs>) available in the Addons Manager.
52-
53-## Configuration
54-
55-The CudaText configuration system uses JSON files: call menu item "Options | Settings - default" and you'll see the default configuration file `default.json`. Copy lines from this file to the file `user.json` displayed by selecting the menu item "Options | Settings - user" and edit the values there to customize your user configuration. The `user.json` is the actual configuration file, the default configuration is provided solely to use as a reference.
56-
57-![Light bulb](https://upload.wikimedia.org/wikipedia/commons/d/d8/Nuvola_apps_ktip.png) **Note:** You can copy the JSON comments from the default file into your user configuration, too. In the user config, include useful lines inside the curly braces `{ }`, this is JSON formatting. Trailing commas on the final key:value pair before a closing brace (`}`) are allowed here.
58-
59-Default config
60- File `settings_default/default.json`, can be opened via menu item "Options | Settings - default". CudaText doesn't use this file, it's only for user reference. CudaText only opens this file by the command, and this file is parsed by plugin "Options Editor Lite".
61-Hotkeys (keyboard shortcuts) config
62- File `settings/keys.json`. Special dialog allows to change all hotkeys in CudaText. You should not edit this file directly, without using the dialog. Dialog is called from "View | Command palette" by pressing `F9`. Dialog allows to set primary+secondary hotkeys for any command (except dynamically added commands which, for example, change current lexer).
63-Plugin configs
64- Files `settings/cuda_*`. Plugins store their settings in there, and files can be in any format (most commonly JSON or INI). Good quality plugins provide menu items in "Options | Settings - plugins" to open their config file, or to show configuration dialog.
65-History files
66- Files `settings/history*.json`. Don't edit them. Mentioned here because sometimes users need to delete their history files (dialog positions, recent files list etc, recent search strings etc).
67-
68-User config
69- File `settings/user.json`. Can be opened via menu item "Options | Settings - user".
70-User lexer-specific configs
71- Files `settings/lexer NNN.json`. It is layer which is read after user config, when user activates some lexer. E.g. if you open C file, config file `lexer C.json` is read. You should not write `ui_` options to lexer-specific configuration files (they may produce weird effects when changing lexers), and some other global options.
72-
73- * For (None) lexer, config file is named `lexer -.json`.
74- * For lite lexers, configuration filenames are appended with a circumflex, e.g. `lexer XML ^.json`
75-
76-Default lexer-specific configs
77- Files `settings_default/lexer NNN.json`. It is layer which is read after user config, but before lexer specific config. CudaText provides several such files, with useful defaults.
78-Lexer-specific hotkeys configs
79- Files `settings/keys lexer NNN.json`. Each such config contains hotkeys for one lexer only.
80-
81-### File types
82-
83-_Example configuration blocks in_ `user.json`
84-```
85-{
86- …
87- "detect": {
88- "*.mht": "HTML",
89- "myconfig.conf": "Nginx",
90- ".profile": "Bash script",
91- },
92- …
93- }
94-```
95-
96----
97-```
98-{
99- …
100- "detect_line": {
101- "<html.*": "HTML",
102- "<!DOCTYPE.*": "HTML",
103- "<\\?xml.*": "XML",
104- },
105- …
106- }
107-```
108-
109-The key:value pairs in the `"detect"` object in `user.json` specify mappings from filename to lexer name.
110-
111- * Each key name represents a single mask or several ';'-separated masks. Masks can be "foo", "*foo", "foo*", "*.foo", "*.foo.bar" etc.
112- * Each key value must map to a lexer name. A value of `-` prevents all automatic lexer activation.
113-
114-Another method to specify these mappings is the "Lexer properties" dialog where you can add extension or name+extension assignments to a specific lexer, however it has limitations; notably, since it saves the custom mappings to the lexer file itself (located in `data/lexlib/lexername.lcf`), those settings will be erased upon re-installation of the lexer or (if it is among the preinstalled lexers) updating to a new version of CudaText.
115-
116-### Language detection by first line regex
117-
118-The key:value pairs in the `"detect_line"` object in `user.json` create rule definitions that trigger lexer activation based on the contents of the first line of a file.
119-
120- * Key name: A case-sensitive (you can use the `(?i)` modifier to disable case-sensitivity) regular expression evaluated using the first line of the file. Note that this is a regular expression using syntax similar to [PCRE](<http://www.wikipedia.org/wiki/Perl_Compatible_Regular_Expressions> "wikipedia:Perl Compatible Regular Expressions"), so for example the `#` character must be escaped with a backslash, and instead of a simple `*` filemask, you must use `.*`. Also note that the current implementation cannot handle forward slashes "/" well, so escape them or use a `.` wildcard instead.
121- * Key value: Lexer name. As noted earlier, a value of `-` means "don't activate a lexer".
122-
123-CudaText has several default values:
124-```
125-"<\?xml .+": "XML",
126- "\#!\/bin\/(ba)?sh": "Bash script",
127- "\#!\/usr\/bin\/env (ba)?sh": "Bash script",
128- "\#!\/usr\/bin\/env python\d*": "Python",
129- "\#!.*\b(node|js|bun|osascript\s+-l\s+JavaScript)": "JavaScript",
130-```
131-
132-### Plugins menu custom groupings
133-```
134-{
135- …
136- "plugin_groups": {
137- "CSS .+": "Web",
138- "HTML .+": "Web",
139- "JS .+": "Web",
140- "Config.+": "Config",
141- "Option.+": "Config",
142- },
143- …
144- }
145-```
146-
147-The "plugin_groups" object in `user.json` allows configuring custom groupings in the Plugins menu, e.g. putting all "HTML …" and "CSS …" menu items into a "Web" submenu. For example:
148-
149- * Key name: A regular expression for the top level of the menu name, e.g. if the menu name in a plugin's `install.inf` is `CSS Utils\Misc\Action`, the top level is `CSS Utils`.
150- * Key value: The group name; the `\` character provides the ability make nested sub-menus.
151-
152-### Location of 'settings', 'py', 'data' folders
153-
154-CudaText distributions are portable, if the executable file is located near the "data" sub-folder. So the distribution for Windows is portable (executable "cudatext.exe" is located near "data"), and distributions from .xz archives are portable too.
155-
156-Not portable CudaText:
157-
158- * Linux: .deb package, which installs binary file to `/usr/bin/cudatext` and several data folders to `/usr/share/cudatext`.
159- * macOS: package, which installs to the "Applications" system folder.
160- * Haiku.
161-
162-For not portable usage, folder "settings" is created here:
163-
164- * Linux, *BSD, Solaris: `~/.config/cudatext`, or `${XDG_CONFIG_HOME}/cudatext` if that environment variable is set
165- * macOS: `~/Library/Application Support/CudaText`
166- * Haiku: `/boot/home/config/settings/cudatext`
167-
168-## Command line flags/arguments
169-
170-Usage:
171-```
172-cudatext [ flag … ] filename …
173-```
174-
175-Supported flags:
176-
177-`-h`/`--help`
178- Show command-line help and exit.
179-`-v`/`--version`
180- Show application version and exit.
181-`-z=value`
182- Open files from command-line in internal viewer, using given viewer mode:
183-
184- * `-z=text` — Text mode with variable line length, single-byte encodings
185- * `-z=binary` — Text mode with fixed line length, single-byte encodings
186- * `-z=hex` — Hexadecimal mode, single-byte encodings
187- * `-z=unicode` — Text mode with variable line length, UTF-16 LE/BE encodings
188- * `-z=uhex` — Hexadecimal mode, UTF-16 LE/BE encodings
189-
190-`-r`
191- Open files from command-line in read-only mode.
192-`-n`
193- Ignore option "ui_one_instance", and open new app window.
194-`-nsl`
195- Don't load last session on start.
196-`-nss`
197- Don't save last session on exit.
198-`-ns`
199- Shortcut to "-nsl" together with "-nss".
200-`-nh`
201- Don't load saved file history (caret, selection, scroll position, etc.).
202-`-nn`
203- Don't suggest to create new file if command-line filename is not found.
204-`-e=value`
205- Open all files from command-line in given encoding.
206-`-el`
207- Show possible encoding names and exit.
208-`-s=folder`
209- Specify full path of the "settings" folder, which contains all configuration files.
210-`-i`
211- Read the contents of stdin to a new document (Linux-only). It can be used in a Linux shell like: `ls -l | cudatext -i`
212-`-verbose`
213- Copy Python messages from Console panel to stdout (Linux-only).
214-`-id=name`
215- Set a "group" for single-instance mode, so that an instance of "group1" will not interfere with instances of "group2". The default id is `cudatext.0`. Note: this switch is not supported on Windows.
216-`-w=left|top|width|height`
217- Set the position/size of the main window. Up to 4 numbers can be specified, and any number can be skipped to keep its previous value.
218-`-c=cuda_module,method_name`
219- Run the specified command plugin on startup. The command plugin is only applied to the currently active editor tab, so make sure you don't pass multiple filenames in the command line, and that the current session doesn't have multiple files. It is often used along with the `-n` and/or `-ns` flags. Need to learn the name of a "cuda_module"? It is the name of subfolder under the "py" folder. Likewise, to discover the "method_name" look for the value of the `method=` key in the `py/cuda_module/install.inf` file.
220-`-p=cuda_module#param1#param2…`
221- Run the specified plugin, and pass to its "on_cli" event the specified param strings. The number of params must be expected by the plugin, e.g. the Differ plugin supports "on_cli" and expects two filenames. If params contain spaces, you must double-quote that entire command-line flag beginning with -p, as in `"-p=…"`.
222-
223-**Notes:**
224-
225- * Filenames can be passed with suffix (at the end of each filename) specifying the line/column numbers for the initial placement of the caret: `@line` or `@line@column`
226- * Folders can be specified too, they will be opened as a "project" in the Project Manager.
227- * Project files (`*.cuda-proj`) can be loaded from the command line.
228- * Non-existing filename can be specified, CudaText will ask if you wish to create the file.
229- * File masks with the `*` wildcard are supported, e.g. `cudatext test/t*.htm*` will work.
230- * Zip filenames can be specified, if they are zipped CudaText add-ons (zip file must contain "install.inf" in proper format).
231-
232-On macOS, you cannot run "cudatext" from the Terminal out of the box, but you can create an alias "cudatext" like this: `alias cudatext=open\ /Applications/CudaText.app\ --args`
233-
234-## Mouse shortcuts
235-
236-![Light bulb](https://upload.wikimedia.org/wikipedia/commons/d/d8/Nuvola_apps_ktip.png) **Note:** For macOS, use the `Cmd ⌘` key instead of the `Ctrl` key in all of the mouse shortcuts listed below.
237-
238-[![](/wiki-images/a/a7/atsynedit-carets.gif)](</File:atsynedit-carets.gif>)
239-
240-[](</File:atsynedit-carets.gif> "Enlarge")
241-
242-Multi-carets in action
243-
244-### Multi-carets
245-
246-Multi-carets are several carets at once. All carets work together for many editing commands: caret moving, text typing, deleting, selection with keyboard.
247-
248- * `Ctrl`+Left click - Add/remove caret.
249- * `Ctrl`+Middle click - Add/remove caret.
250- * `Ctrl`+Left click and drag - Add caret with selection.
251- * `Ctrl`+`⇧ Shift`+Left click - Add column of vertically-aligned carets, from the previous caret position to the clicked line.
252-
253-Dragging
254-
255- * `⎇ Alt`+drag - Make **column selection**.
256- * Drag on Gutter line numbers - Select text by entire lines.
257- * Double left-click and immediately drag - Select text by words.
258-
259-Clicks
260-
261- * Double left-click - Select clicked word; this behavior can be customized as described in **§ How to select extra symbols by double-click** using the `nonword_chars` option.
262- * Triple left-click - Select entire line (block is limited by newline characters).
263- * Middle-click - Configurable by option `mouse_middle_click`, choices are:
264-
265- 0. **(0)** Nothing.
266- 1. **(1)** Start "browser scrolling" mode: circle mark appears and mouse moving around this mark auto-scrolls text in 4 directions; speed of scrolling depends on distance of cursor from circle mark (any click to turn off).
267- 2. **(2)** Paste from clipboard. This mimics Linux apps behaviour.
268- 3. **(3)** Call "Go to definition" command.
269-
270- * Click on Back/Forward mouse buttons - These clicks do nothing by default, but they produce keyboard actions BrowserBack/BrowserForward (extended keys on Windows keyboards), and so they can be assigned in the hotkeys setup dialog (`F9` in the Command Palette). For example, `Ctrl`+Back produces `Ctrl`+BrowserBack keyboard action.
271-
272-Miscellaneous
273-
274- * `⇧ Shift`+`⎇ Alt`+Left-click - Make vertical (column) selection, from the first caret to the clicked position.
275- * `⇧ Shift`+Scroll mouse wheel - Scroll text horizontally.
276- * `Ctrl`+Scroll mouse wheel (with option `mouse_wheel_zoom: true`) - Zoom text in/out.
277- * `Ctrl`+Scroll mouse wheel (in the picture viewer) - Zoom picture in/out.
278- * `⇧ Shift`+Left-click on gutter line number - Select lines, from first caret position to the index of clicked line.
279-
280-Drag-drop of selected text block
281-
282- * Dragging inside single document: if `Ctrl` is pressed during the drop (you should press `Ctrl` after dragging is started), block will be copied (not moved) to the pointed position.
283- * Dragging to a different document (see **§ Groups of tabs**): if `Ctrl` is pressed during the drop, block will be moved (otherwise it will be copied).
284-
285-The command "Go to definition" can be called by different mouse shortcuts: by `Ctrl`+`⎇ Alt`+Left-click (default), `⎇ Alt`+Left-click, etc.; this depends on the `mouse_goto_definition` option.
286-
287-## Multi-selections
288-
289-[![](/wiki-images/b/b7/atsynedit-sel.gif)](</File:atsynedit-sel.gif>)
290-
291-[](</File:atsynedit-sel.gif> "Enlarge")
292-
293-Multi-selection feature
294-
295-If you place a caret with `Ctrl`+Left-click, the caret has no selection, whereas if you add a caret with `Ctrl`+Drag, the caret will have a selection. You can add selections to carets later, by `⇧ Shift`+`◀`/`▲`/`▼`/`▶`/`Home`/`End`, etc.
296-
297-Multi-selections are handled specially on copy/paste. If you copy selections, then move carets, then paste, paste will insert clipboard lines into carets: line-1 at caret-1, line-2 at caret-2 etc (only if carets count equals to lines count in clipboard, otherwise result is different).
298-
299-### Commands with selections
300-
301-Clipboard commands work with multi-carets and multi-selections the special way. Also "Delete char" commands (`Del ⌦`/`⌫ Backspace` keys) works the special way.
302-
303-Command | Behaviour with no selections | Behaviour with at least one selection
304----|---|---
305-Copy to clipboard | Copies entire lines, containing carets. Ignores multiple carets on a same line. | Copies only selections text. Ignores carets without selections.
306-Cut to clipboard | Similarly to "Copy" without selections. | Similarly to "Copy" with selections.
307-Paste from clipboard | First, selections are cleared (deleted). Then, command pastes text into each caret position. Special case is when clipboard lines count equals to carets count - in this case, first line is inserted at first caret, second line is inserted at 2nd caret, etc.
308-Delete char left (Backspace) / Delete char right | Deletes one char at each caret position. | Deletes only selections text. Ignores carets without selections.
309-
310-## Lexers
311-
312-[![](/wiki-images/2/2f/cudatext-lexer-library.png)](</File:cudatext-lexer-library.png>)
313-
314-[](</File:cudatext-lexer-library.png> "Enlarge")
315-
316-CudaText lexer library
317-
318-Syntax highlighters in CudaText are called _lexers_ , and are compatible with the SynWrite editor (which is frozen). The Lexer engine itself is borrowed from [EControl.ru](<http://www.econtrol.ru/syntedit.html>), with modifications by Alexey Torgashin. The primary modification is the addition of support for folding code blocks in Python and other languages with indentation-based folding, while others include the porting from Delphi to Free Pascal along with various optimizations. EControl.ru's original lexer engine is closed source, but CudaText's version is open source, with the permission from EControl.ru.
319-
320- * The **Lexer properties** dialog provides access to the configurable properties of the current lexer (selected via the status bar). Those properties are: lexer name, file types, commenting style, token colors, font styles (bold/italic/underline) and token borders.
321- * The **Lexer library** dialog shows a list of the installed lexers, which reside in the folder `data/lexlib`. This dialog has the following hotkeys:
322-
323-
324-
325-
326-
327-`Enter ⏎`
328- same as "Configure" button
329-`Del ⌦`
330- same as "Delete" button
331-`Esc`
332- closes the dialog
333-
334-[![](/wiki-images/a/a4/cudatext-zip-install-prompt.png)](</File:cudatext-zip-install-prompt.png>)
335-
336-[](</File:cudatext-zip-install-prompt.png> "Enlarge")
337-
338-Add-on ZIP file install dialog
339-
340-### Lexers on SourceForge
341-
342-CudaText installs with a limited set of lexers. All other lexers are available as [individual downloads hosted on cudatext.sf.net](<https://sourceforge.net/projects/cudatext/files/addons/lexers/>) or collectively as part of the [complete add-ons package](<https://sourceforge.net/projects/cudatext/files/addons_all/>), too.
343-
344-To install "lexer.*.zip" (or any add-on ZIP file) in CudaText: open this ZIP file via "File / Open", CudaText will suggest to install it.
345-
346-### List of lexers
347-
348-The following lexers (counting only important ones) exist for CudaText. They are available through the Addons Manager's **Install…** command.
349-
350-All these lexers, and preinstalled lexers, are published in the repository: <https://github.com/CudaText-addons/CudaText-lexers> . This link may be needed for people wanting to make 'Pull Requests' in Git.
351-
352- * [1C:Enterprise script](<https://1c-dn.com/1c_enterprise/1c_programming_language/>)
353- * [ABAP](<https://learning.sap-press.com/abap>)
354- * [Abaqus Keywords](<https://www.3ds.com/products-services/simulia/products/abaqus/>)
355- * [abc notation](<https://abcnotation.com/>)
356- * [ActionScript](<https://help.adobe.com/en_US/as3/learn/index.html>)
357- * [ACUCOBOL](<https://www.microfocus.com/en-us/products/acucobol-gt/overview>)
358- * [Ada](<http://www.ada-auth.org/standards/rm12_w_tc1/html/RM-TTL.html>)
359- * [Adept](<https://www.met.reading.ac.uk/clouds/adept>)
360- * [Amazon Ion](<https://amazon-ion.github.io/ion-docs/>)
361- * [AMPL](<https://ampl.com/>)
362- * [AngelScript](<https://www.angelcode.com/angelscript/>)
363- * [ANTLR](<https://www.antlr.org/>)
364- * [APDL](<https://www.ansys.com/blog/what-is-apdl>)
365- * [AppleScript](<https://developer.apple.com/library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/introduction/ASLR_intro.html>)
366- * [Arduino](<https://www.arduino.cc/reference/en/>)
367- * [AsciiDoc](<https://asciidoc.org/>)
368- * [Assembly (ASM)](<http://www.wikipedia.org/wiki/Assembly_language> "wikipedia:Assembly language"):
369- * [ARM Assembly (armasm)](<https://developer.arm.com/documentation/102438/0100/Learning-about-assembly-language>)
370- * [STM32 ARM Assembly](<https://blog.st.com/stdevcon18-stm32-embedded-systems-assembly/>)
371- * [AVR Assembly (AVRASM2)](<https://ww1.microchip.com/downloads/en/DeviceDoc/40001917A.pdf>)
372- * [Dalvik bytecode (Smali)](<https://source.android.com/docs/core/runtime/dalvik-bytecode>)
373- * [Flat Assembly (fasm)](<https://flatassembler.net/>)
374- * [Game Boy/GB Color Assembly (RGBDS)](<https://rgbds.gbdev.io/>)
375- * [GNU Assembly (as/gas)](<https://sourceware.org/binutils/docs-2.41/as.html>)
376- * [JWasm Assembly](<https://www.japheth.de/JWasm/Manual.html>)
377- * [Microsoft Macro Assembler x86/x64 (MASM)](<https://learn.microsoft.com/en-us/cpp/assembler/masm/microsoft-macro-assembler-reference?view=msvc-170>)
378- * [MIPS Assembly](<https://web.cse.ohio-state.edu/~crawfis.3/cse675-02/Slides/MIPS%20Instruction%20Set.pdf>)
379- * [Motorola 68000 Assembly](<http://68k.hax.com/>)
380- * [Netwide Assembly x86 (NASM)](<https://www.nasm.us/>)
381- * [PowerPC Assembly](<http://wikibooks.org/wiki/PowerPC_Assembly> "wikibooks:PowerPC Assembly")
382- * [RISC-V Assembly](<http://www.wikipedia.org/wiki/RISC-V_assembly_language> "wikipedia:RISC-V assembly language")
383- * [SHARC DSP Assembly](<https://www.analog.com/media/en/dsp-documentation/processor-manuals/236999443isr_21xxx.pdf>)
384- * [SPARC Assembly](<http://wikibooks.org/wiki/SPARC_Assembly> "wikibooks:SPARC Assembly")
385- * [Z80 Assembly (SjASM)](<https://xl2s.tk/sjasmmanual.html>)
386- * [Astro](<https://astro.build/>)
387- * [Asymptote](<http://www.wikipedia.org/wiki/Asymptote_\(vector_graphics_language\)> "wikipedia:Asymptote \(vector graphics language\)")
388- * [AutoHotkey](<https://www.autohotkey.com/docs/v2/Language.htm>)
389- * [AutoIt](<http://www.wikipedia.org/wiki/AutoIt> "wikipedia:AutoIt")
390- * [Automake](<http://www.wikipedia.org/wiki/Automake> "wikipedia:Automake")
391- * [Automation Basic (B&R Automation Studio)](<https://www.br-automation.com/en-us/products/software/additional-information/programming/#c56724>)
392- * [AviSynth](<http://avisynth.nl/index.php/The_full_AviSynth_grammar>)
393- * [AWK](<http://www.wikipedia.org/wiki/AWK> "wikipedia:AWK")
394- * [Ballerina](<http://www.wikipedia.org/wiki/Ballerina_\(programming_language\)> "wikipedia:Ballerina \(programming language\)")
395- * [Bash shell](<http://www.wikipedia.org/wiki/Bash_\(Unix_shell\)> "wikipedia:Bash \(Unix shell\)")
396- * [Batch file](<http://www.wikipedia.org/wiki/Batch_file> "wikipedia:Batch file")
397- * [Bazel configuration (bazelrc)](<https://bazel.build/run/bazelrc>)
398- * [BibTeX](<http://www.wikipedia.org/wiki/BibTeX> "wikipedia:BibTeX")
399- * [Bicep (Azure Resource Manager)](<https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/file>)
400- * [Blueprint (GTK 4 UI compiler)](<https://gnome.pages.gitlab.gnome.org/blueprint-compiler/>)
401- * [Bohemia Real Virtuality (SQF)](<https://community.bistudio.com/wiki/SQF_Syntax>)
402- * [Boo](<http://www.wikipedia.org/wiki/Boo_\(programming_language\)> "wikipedia:Boo \(programming language\)")
403- * [Brainfuck](<http://www.wikipedia.org/wiki/Brainfuck> "wikipedia:Brainfuck")
404- * [C](<http://www.wikipedia.org/wiki/C_\(programming_language\)> "wikipedia:C \(programming language\)")
405- * [C++](<http://www.wikipedia.org/wiki/C%2B%2B> "wikipedia:C++")
406- * [C#](<http://www.wikipedia.org/wiki/C_Sharp_\(programming_language\)> "wikipedia:C Sharp \(programming language\)")
407- * [C3](<https://c3-lang.org/>)
408- * [Caffe (prototxt)](<https://caffe.berkeleyvision.org/>)
409- * [Cangjie](<http://www.wikipedia.org/wiki/Cangjie_\(programming_language\)> "wikipedia:Cangjie \(programming language\)")
410- * [Carbon](<http://www.wikipedia.org/wiki/Carbon_\(programming_language\)> "wikipedia:Carbon \(programming language\)")
411- * [Clarion](<http://www.wikipedia.org/wiki/Clarion_\(programming_language\)> "wikipedia:Clarion \(programming language\)")
412- * Clavier
413- * [Clipper](<http://www.wikipedia.org/wiki/Clipper_\(programming_language\)> "wikipedia:Clipper \(programming language\)")
414- * [Clojure](<http://www.wikipedia.org/wiki/Clojure> "wikipedia:Clojure")
415- * [CMake](<http://www.wikipedia.org/wiki/CMake> "wikipedia:CMake")
416- * [COBOL](<http://www.wikipedia.org/wiki/COBOL> "wikipedia:COBOL")
417- * [CodeVisionAVR](<https://www.codevision.be/>)
418- * [CoffeeScript](<http://www.wikipedia.org/wiki/CoffeeScript> "wikipedia:CoffeeScript")
419- * [ColdFusion markup](<http://www.wikipedia.org/wiki/ColdFusion_Markup_Language> "wikipedia:ColdFusion Markup Language")
420- * [Conditional Random Fields (CRF)](<http://www.wikipedia.org/wiki/Conditional_random_field> "wikipedia:Conditional random field")
421- * [Crystal](<http://www.wikipedia.org/wiki/Crystal_\(programming_language\)> "wikipedia:Crystal \(programming language\)")
422- * [CSS](<http://www.wikipedia.org/wiki/CSS> "wikipedia:CSS")
423- * [CUDA C++](<https://docs.nvidia.com/cuda/cuda-programming-guide/02-basics/intro-to-cuda-cpp.html>)
424- * [CUE](<https://cuelang.org/>)
425- * [Cue sheet](<http://www.wikipedia.org/wiki/Cue_sheet_\(computing\)> "wikipedia:Cue sheet \(computing\)")
426- * [Colecovision BASIC {CVBasic)](<https://nanochess.org/cvbasic.html>)
427- * [D](<https://dlang.org/>)
428- * [Dafny](<https://dafny.org/>)
429- * [Dart](<https://dart.dev/>)
430- * [Delphi resources](<https://www.delphibasics.info/home/delphibasicssnippets/usingresourcefileswithdelphi>)
431- * [Dhall](<https://dhall-lang.org/>)
432- * [Dictu](<https://dictu-lang.com/>)
433- * [Diff / Patch files](<http://www.wikipedia.org/wiki/diff#Default_output_format> "wikipedia:diff")
434- * [Dockerfile](<https://docs.docker.com/build/concepts/dockerfile/>)
435- * [DOORS Extension Language (DXL)](<http://www.wikipedia.org/wiki/DOORS_Extension_Language> "wikipedia:DOORS Extension Language")
436- * [Eiffel](<http://www.wikipedia.org/wiki/Eiffel_\(programming_language\)> "wikipedia:Eiffel \(programming language\)")
437- * [Elixir](<https://elixir-lang.org/>)
438- * [Elm](<https://elm-lang.org/>)
439- * [.env files](<https://www.dotenv.org/docs>)
440- * [Erlang](<https://www.erlang.org/>)
441- * [Embedded Lua templates](<https://github.com/leafo/etlua>)
442- * [Euphoria](<http://www.wikipedia.org/wiki/Euphoria_\(programming_language\)> "wikipedia:Euphoria \(programming language\)")
443- * F#
444- * Factor
445- * Falcon
446- * Fish
447- * FIX Message (Financial Information eXchange)
448- * foobar2000 title formatting (it's for Mp3tag too)
449- * Forth
450- * Fortran
451- * FoxPro
452- * FreeBASIC
453- * Futhark
454- * G-code (this is "lite" lexer)
455- * GAMS
456- * GDScript
457- * [Gel Schema Definition Language (EdgeQL)](<https://docs.geldata.com/learn/schema>)
458- * Gemini (web pages)
459- * Gherkin (Cucumber; Behat)
460- * GHS.com MULTI IDE (3 lexers)
461- * Gleam
462- * GLSL
463- * GNU linker
464- * Gnuplot
465- * Go
466- * Gold Parser
467- * Grails Server Pages (GSP)
468- * Graphviz DOT
469- * GraphQL
470- * Great Cow Basic
471- * Groovy (Gradle)
472- * Grub4Dos
473- * Haml
474- * Harbour
475- * Hare
476- * Haskell
477- * Haxe
478- * HCL (HashiCorp Configuration Language)
479- * Heta
480- * [HiveQL (Apache Hive)](<https://cwiki.apache.org/confluence/display/Hive/LanguageManual>)
481- * HJSON
482- * HLSL
483- * HTML
484- * HTML Diafan
485- * HTML Django DTL
486- * HTML Embedded JS
487- * HTML Handlebars
488- * HTML Laravel Blade
489- * HTML Liquid
490- * HTML Mustache
491- * HTML Ruby-ERB
492- * HTML Smarty
493- * [httpd.conf (Apache HTTP Server)](<https://httpd.apache.org/docs/2.4/configuring.html>)
494- * Huawei VRP
495- * IDL files
496- * IDL language
497- * Informix 4GL
498- * Ini files
499- * Inno Setup
500- * Intel HEX
501- * Intel ISPC (Implicit SPMD Program Compiler)
502- * Janet
503- * Jasmine JVM Assembler
504- * Java
505- * Java Velocity
506- * JavaScript
507- * JavaScript Babel/React JSX
508- * JCL
509- * Jinja2
510- * JQ
511- * JSON
512- * [Bitsquid Simplified JSON (SJSON)](<https://bitsquid.blogspot.com/2009/10/simplified-json-notation.html>)
513- * Jsonnet
514- * Julia
515- * Just
516- * [KDL](<https://kdl.dev/>)
517- * Kivy
518- * KiXtart
519- * Koka
520- * Kontakt Script Processor (KSP)
521- * Kotlin
522- * languageONE
523- * LaTeX
524- * Lean
525- * LESS
526- * Lisp
527- * [Common Lisp](<http://www.wikipedia.org/wiki/Common_Lisp> "wikipedia:Common Lisp")
528- * LiveCode script
529- * Log files
530- * Logstash DSL
531- * Lola-2
532- * LS-DYNA
533- * Lua
534- * [M4](<http://www.wikipedia.org/wiki/m4_\(computer_language\)> "wikipedia:m4 \(computer language\)")
535- * Macro Scheduler script
536- * Makefile
537- * Markdown
538- * MATLAB
539- * Maya
540- * MDX (Markdown with JSX)
541- * MediaWiki
542- * Meson
543- * Metafont
544- * MIB files
545- * MikroTik Script
546- * MiniZinc
547- * Modelica
548- * Modula-2
549- * Modula-3
550- * Mojo
551- * Monkey
552- * MoonBit
553- * MS Visual Studio Solution
554- * MusicBrainz Picard Tagger Script
555- * MySQL
556- * Nelua
557- * Nemerle
558- * Nginx
559- * Nim
560- * Nix
561- * nnCron
562- * NSIS
563- * NSL Assembler
564- * Oberon (and Component Pascal)
565- * Objeck
566- * Objective-C
567- * OCaml
568- * Odin
569- * OpenCL
570- * OpenEdge
571- * OpenSCAD
572- * Org-mode
573- * P4 (Programming Protocol-independent Packet Processors)
574- * Papyrus (for Skyrim game)
575- * Parser3
576- * Pascal
577- * Pawn
578- * PECmd script
579- * Perforce Jam
580- * Perl
581- * PHP
582- * PICL
583- * [Pig Latin (Apache Pig)](<https://pig.apache.org/docs/r0.17.0/start.html#pl-statements>)
584- * Pike
585- * Pixilang
586- * PKGBUILD
587- * Pkl
588- * PL/SQL
589- * PlantUML
590- * Pony
591- * PostScript
592- * Power Query M
593- * PowerShell
594- * Prolog
595- * Properties
596- * Protocol Buffers
597- * Pug (previosly named "Jade")
598- * Puppet
599- * PureBasic
600- * PureScript
601- * PyMOL
602- * Pyret
603- * Python
604- * [Cython](<https://cython.org/>)
605- * QML (Qt Modeling Language)
606- * R
607- * R Markdown
608- * Racket
609- * Rainmeter
610- * Ragel
611- * Raku
612- * Razor
613- * ReasonML
614- * Red
615- * ReScript
616- * reStructuredText
617- * Rexx
618- * Ring
619- * Roc
620- * [Rocq Prover](<http://www.wikipedia.org/wiki/Rocq> "wikipedia:Rocq")
621- * RON
622- * RPG/IV
623- * RTF (Rich Text)
624- * Ruby
625- * Rust
626- * Sass
627- * Scala
628- * Scheme
629- * Scilab
630- * SCSS
631- * SFZ Format
632- * Singularity
633- * Slim
634- * Smalltalk
635- * Snowflake SQL
636- * Solidity (Ethereum)
637- * Specman
638- * SPICE (PSpice, HSPICE)
639- * SPIR
640- * SQL (normal and "lite" lexers available)
641- * Squirrel
642- * SRT Subtitles
643- * Standard ML
644- * STAR (Self-defining Text Archive and Retrieval) (this is "lite" lexer)
645- * Stata
646- * Strace
647- * Structured Text (IEC 61131-3)
648- * Stylus
649- * Svelte
650- * Swift
651- * SystemTap
652- * T-SQL
653- * TAGML
654- * TakeCommand
655- * Tcl/Tk
656- * Textile
657- * ToDo (for plugin "Plain Tasks")
658- * Todo.txt (format from todotxt.org)
659- * TOML
660- * Tree
661- * Twig
662- * TypeScript
663- * Typst
664- * Umka
665- * V
666- * Vala
667- * VBScript
668- * Verilog HDL
669- * VHDL
670- * Vimscript
671- * Virgil
672- * Visual Basic
673- * Visual dBase
674- * VRML
675- * Vue
676- * WGSL
677- * WikidPad (normal and "lite" lexers available)
678- * WinBuilder script
679- * Windows Resource Script
680- * Wolfram
681- * Wren
682- * WSH script
683- * XML
684- * XSLT
685- * Yacc (Bison)
686- * YAML
687- * ZenScript (MineTweaker)
688- * Zephir
689- * Zig
690- * Ziggy
691-
692-### Lexers modification and creation
693-
694-[![SynWrite "Lexer properties" dialog](/wiki-images/e/ed/cudatext-lexer-editor-dlg.png)](</File:cudatext-lexer-editor-dlg.png>)
695-
696-[](</File:cudatext-lexer-editor-dlg.png> "Enlarge")
697-
698-Screenshot of SynWrite's "Lexer properties" dialog
699-
700-You can modify/create lexers. But not in CudaText. Install [SynWrite](<https://cudatext.github.io/synwrite/>) (Windows program, which can be run under Wine on Linux). There, you have lexer editor dialog.
701-
702- * First, install your lexer to SynWrite. From the lexer's .zip package, copy files lexername.lcf and lexername.cuda-lexmap into SynWrite's "data\lexlib" folder.
703- * In SynWrite, call "Lexer properties" dialog and edit all you need.
704- * In SynWrite, install "ExLexer" addon. Then call "ExLexer" from the "Plugins" menu, choose needed lexer to export. You will have exported .zip file.
705- * In CudaText open this .zip file, confirm installation of lexer.
706-
707-### Lexers editing - styles only
708-
709-For full-featured lexer editing, you must use SynWrite as described in the topic above. CudaText itself allows to edit only lexer styles, ie colors/ borders/ font-style (bold/italic/strikeout) of lexer styles. How to do that:
710-
711- * Activate some lexer for the current document.
712- * Call CudaText menu "Options / Lexers / Lexer properties", dialog "Lexer properties" will open.
713- * In the "Lexer properties" dialog, activate "Styles" tab, it has UI to customize styles in the active lexer. This UI is enabled only when lexer themes are Off, ie option `"ui_lexer_themes":false`.
714-
715-By default that option is On so UI is disabled. If you enable the UI, you can customize all lexer styles. Configuration will be saved to the files "settings/*.cuda-lexops". These files are auto-loaded by CudaText on start.
716-
717-### How to setup styles of hidden sublexer
718-
719-Some lexers are distributed in packages together with sub-lexer, and sub-lexer is hidden. Example: "HTML Django" with sub-lexer "HTML Django internal" (the second one isn't visible in the Lexers menu, so it's called hidden). Users, which have option "ui_lexer_themes" off, want to configure styles of all lexers. How to access hidden ones?
720-
721- * Open "Lexer library" dialog (menu: Options / Lexer / Lexer library).
722- * In dialog, focus needed lexer, press "Configure" button
723- * Dialog "Lexer properties" will open for selected lexer
724- * In dialog's "Styles" tab, configure all you need
725-
726-You can change visibility of lexer in SynWrite lexer editor (the checkbox will write line "Internal = True" at the end of .lcf file).
727-
728-### How to create distributive of new lexer
729-
730-In SynWrite, you've created .lcf file in folder SynWrite/Data/LexLib. If you configured "Commenting" options, also file .cuda-lexmap is created. Now you need to create .zip installation of lexer, for both editors: SynWrite, CudaText.
731-
732- * In lexer file, replace system colors to usual colors: replace "clWindowText" to "clBlack" (clWindowText may be light on CudaText on Linux); replace "clInfoText" and "clInfoBk" too.
733- * In SynWrite, in Addon Manager, install plugin "ExLexer".
734- * In SynWrite, run menu item "Plugins / ExLexer", to create .zip for your lexer.
735- * In CudaText, open this new zip file, this installs lexer to CudaText.
736- * In CudaText, activate your lexer, dialog should show: "Lexer style mapping". Fill items in this dialog.
737- * In CudaText, test this "lexer style map" in action: open file with your lexer active, and activate "default" UI theme, then activate "sub" UI theme. Main themes must show nice colors in your syntax file. Call dialog "Options / Lexers / Lexer style mapping" to fix colors.
738- * In prev step, you configured .cuda-lexmap file, in folder CudaText/data/lexlib. Copy this file to zip installation of your lexer.
739- * Zip must contain: install.inf, .lcf file(s), .cuda-lexmap file per each lexer.
740-
741-You can place file(s) "lexer LexerName.json" into zip archive, per each lexer in zip archive. These JSON files will be installed to the folder "settings_default" of CudaText. Ie, these are lexer-specific configs for lexers. Some lexers do this already: Lua, Pascal, PHP, Ruby, TypeScript.
742-
743-### Lite lexers
744-
745-Lite lexers are lexers is special format (internally it's JSON file), with very limited features. They don't support code-tree, folding, don't support multi-line comments, don't have rich highlighting (e.g. background highlight of string `12+$var` with additional highlight for 12 and $var inside). And they don't keep tokens information in memory (positions of found tokens in text). Lite lexers process only lines visible on screen, not all document lines. So, they work fast for any file size.
746-
747-Limitation: on lines longer than 4K chars, only first 4K chars have the syntax highlighting.
748-
749-Lite lexers have the " ^" suffix in name. You can activate lite lexers from the usual lexers menu. Several lite lexers are preinstalled:
750-
751- * Ini files ^
752- * JSON ^
753- * Log files ^
754- * SQL ^
755- * XML ^
756-
757-Lite lexers are automatically activated for big files, when file size is bigger than option "ui_max_size_lexer". For example, for small sized JSON files normal "JSON" lexer is activated, but for huge JSON files - lite lexer "JSON ^" is automatically activated. Lite lexers are activated for small files, if normal lexer for file-extension is not found. For example, "SQL ^" is used for small SQL files, because "normal" SQL lexer is not preinstalled.
758-
759-How to change styles in lite lexers? For example, "Log files ^" uses styles "Id"/"Id2", and you want to change that? It's easy:
760-
761- * open the file: [CudaText]/data/lexliblite/Log files.cuda-litelexer
762- * find and edit styles names
763- * all possible styles are listed in the CudaText dialog "Options / Themes / Settings - theme - syntax..."
764-
765-Here is short description of file fields, on the example file "data/lexliblite/Ini files.cuda-litelexer":
766-```
767-{
768- "about": "INI lexer by Alexey Torgashin",
769- "files": "*.ini;*.dsk;*.dti;*.dof;*.inf;*.lng;*.srv;*.reg;*.sas;*.cfg;*.desktop",
770- "cmt_line": ";",
771- "case_sens": true,
772- "consider_spaces": true,
773- "rules": {
774- "cmt": {
775- "regex": "^\\s*[;\\#].*",
776- "style": "Comment"
777- },
778- ...
779- "val": {
780- "regex": "\\w+",
781- "style": "Id"
782- }
783- }
784- }
785-```
786-
787- * "about": Info about file's author.
788- * "files": One or several file masks, separated by ";".
789- * "cmd_line": Single-line comment chars. Used by "Comments" plugin when you call commands of this plugin.
790- * "case_sens": Boolean flag for case-sensitivity for RegEx-rules listed below in that file.
791- * "consider_spaces": Boolean flag which enables to parse spaces/tabs between words by RegEx-rules. Otherwise, parser will skip spaces/tabs silently.
792- * "rules": Dictionary with parser rules, which must have one or more dictionaries with any names but fixed contents:
793- * "regex": RegEx (ie regular expression) of the rule.
794- * "style": Style name, to color that rule results. Possible values are listed in the CudaText dialog "Options / Themes / Settings - theme - syntax..."
795-
796-### Differences in lexer support in CudaText/SynWrite
797-
798- * SynWrite supports "lexer grammar", while CudaText does not support "grammar" anymore.
799- * SynWrite lexers need constructs like \x0D\x0A or \z (to catch any line-break: LF, CRLF, CR), while CudaText lexers are OK with simple \n (because internal buffer always has LF separator).
800- * Some lexers need to find equal identifiers at begin/end of blocks: HTML, Bash, others. Bash lexer needs extended feature: to see NAME and 'NAME' and "NAME" as equal identifiers (word and quoted word). Only CudaText has this extended feature, not SynWrite.
801- * For CudaText you must avoid "system colors" in lexer styles (e.g. "window background", "window text", "hint background"), because OS'es have different system colors.
802- * SynWrite lexer settings are not used in CudaText:
803- * Option "Restart analysis from the line start" has no effect, it is forced to On in CudaText
804- * Default style
805- * Selection mark style
806- * Search mark style
807- * Current line style
808- * Collapse mark style
809- * Character set
810- * Multiline border
811- * Options in groups "Syntax tree decoration", "Pen"
812-
813-### How to make editor re-scan entire document on editing
814-
815-The question makes sense, because when user types the block ending (e.g. "}" in C syntax), editor re-scans the document from the last changed line, and cannot detect that new block is just appeared.
816-
817-Find the lexer file, .lcf file in the folder data/lexlib. This file has the ending with "end", before "end" you see several lexer settings. You can add there:
818-```
819-FullRefreshSize = 5000
820-```
821-
822-Insert it near the end of file, like here:
823-```
824-FullRefreshSize = 5000
825- Charset = DEFAULT_CHARSET
826- end
827-```
828-
829-This tells lexer to re-scan entire document, on editing in any document place, when document size is less than 5000 chars.
830-
831-### How to support Spell Checker in lexer
832-
833-Plugin "Spell Checker" checks text, which is inside "strings" and "comments". So you must configure lexer and set there, which lexer elements (tokens) are "strings" and "comments". It is options in the "Lexer properties" dialog of SynWrite, in the "Commenting" tab of dialog. You can change these options without SynWrite too - they are in the "data/lexlib/LexerName.cuda-lexmap" file, both options are comma-separated names of lexer styles.
834-
835-For example, let's see XML lexer. Spell Checker must handle these styles:
836-
837- * style applied to XML/HTML comments
838- * style applied to quoted strings in XML tags
839- * style applied to usual text out of angle brackets
840-
841-If you see lexer config in SynWrite, you will find that we need styles "Comment", "Text" and "Tag val". So we specify in the file "data/lexlib/XML.cuda-lexmap":
842-```
843-[comments]
844- styles_cmt=Comment
845- styles_str=Text,Tag val
846-```
847-
848-## Fenced code-blocks
849-
850-[![](/wiki-images/5/59/cudatext-fenced-blocks.png)](</File:cudatext-fenced-blocks.png>) [](</File:cudatext-fenced-blocks.png> "Enlarge")Fenced code blocks
851----
852-
853-This is the feature of Markdown syntax: fenced code blocks. Blocks begin with:
854-
855- * start of line
856- * optional spaces
857- * 3 or more backtick-chars (also tilde-chars are allowed)
858- * optional spaces
859- * lexer alias like "cpp" or "cs"
860- * optional spaces
861- * end of line.
862-
863-Blocks end with:
864-
865- * start of line
866- * optional spaces
867- * 3 or more backtick-chars (also tilde-chars are allowed)
868- * optional spaces
869- * end of line.
870-
871-The beginning and ending sequences are tokenized as single token.
872-
873-CudaText has the file which lists the supported lexer aliases: data/lexlib/aliases.ini. The file was compiled from [this document](<https://github.com/highlightjs/highlight.js/blob/main/SUPPORTED_LANGUAGES.md>). Lexer alias will be resolved to the actual lexer name, only if that lexer is installed, otherwise you won't see an error, but block will not be syntax-highlighted.
874-
875-**Limitations:**
876-
877- * Markdown standard tells that the beginning backticks must match the ending backticks, it must be the same amount of backticks. (And the same is valid for tildes.) This is currently not supported in CudaText.
878- * Python Markdown description tells that the lexer alias may be replaced with the curly-brackets construct like "{ .lang }" or "{ .lang .foo .bar }" or even "{ #someid .lang .foo .bar }". This is currently not supported in CudaText.
879- * The similar feature of the reStructuredText, as [documented here](<https://pandemic-overview.readthedocs.io/en/latest/myGuides/reStructuredText-Source-Code.html>), is not supported.
880-
881-**Note about SQL blocks.**
882-
883-CudaText has lexer preinstalled, it's lite lexer "SQL ^", and it cannot be used here, because lite lexer cannot be called from normal lexer. But you can install (from "Plugins / Addons Manager") normal lexers: SQL; T-SQL (T-SQL has it's own alias "tsql"). Just install one of them, and it will be used for SQL blocks.
884-
885-**Note about Typst lexer.**
886-
887-This lexer also supports fenced code blocks but it has its own independent rules of sub-lexers. It means Typst lexer does not rely on CudaText special code to search for sub-lexers. It has own rules. For example, for sub-lexer 'Bash script', Typst has such RegEx to search for block beginning:
888-```
889-`{3,}(shell-script|sh|bash|zsh)\b
890-```
891-
892-and such RegEx to search for block ending:
893-```
894-`{3,}(?!\w)
895-```
896-
897-## Dynamic highlight
898-
899-[![](/wiki-images/f/f8/cudatext-dynamic-hi.png)](</File:cudatext-dynamic-hi.png>) [](</File:cudatext-dynamic-hi.png> "Enlarge")Dynamic highlighting for HTML/XML/Lua
900----
901-
902-Dynamic highlight is controlled by option "dynamic_highlight". Option allows the caret-dependant highlighting only in documents which have not more than N (option value) lines. This limitation is useful because dynamic highlight makes lexer parsing slower.
903-
904-Feature enables to highlight some 'tokens' dynamically (with default greenish background color), when caret changes position. It works only when lexer is configured to use this feature. These lexers in the CudaText distro use it:
905-
906- * HTML, PHP, XML: opening tag and corresponding closing tag are highlighted, when caret is over one of them
907- * CSS: rule highlights {} block with different background color, when caret is inside that block
908- * Bash: block edge tokens are highlighted when caret is inside the block: 'if'/'fi', 'case'/'esac', 'do'/'done'
909- * Lua: block edge tokens are highlighted when caret is inside the block: 'function'/'end', 'if'/'end', 'do'/'end'
910-
911-**Examples:**
912-
913- * On the HTML example editor, 2 fragments have dynamic highlighting (because of 2 multi-carets). First caret is placed inside tag 'h1' but before tag 'a'. Second caret is placed inside tag 'a'. So second caret enables dynamic highlight of angle brackets too, not only of a tag.
914- * On the XML example editor, lexer highligts 'data' tag, surrounding the caret.
915- * On the Lua example editor, lexer highlights 2 nested blocks, surrounding the caret: function/end and do/end.
916-
917-In the old times, dynamic highlight was also utilized in Pascal lexer to highlight tokens 'begin'/'end' when caret is inside the block. Later Pascal lexer was simplified and setting was removed. Few other lexers from Addons Manager also utilize this feature.
918-
919-It is possible to detect if some lexer utilizes this feature. Look inside LexerName.lcf file, find there "DynHighlight" parameter. Two typical configurations allow dynamic highlight:
920-
921-HTML, PHP, Lua:
922-```
923-DynHighlight = dhBound
924- HighlightPos = cpRange
925-```
926-
927-CSS:
928-```
929-DynHighlight = dhRange
930- HighlightPos = cpRange
931-```
932-
933-## Folding
934-
935-[![](/wiki-images/4/4b/cudatext-folding-gutter-ctx-menu.png)](</File:cudatext-folding-gutter-ctx-menu.png>) [](</File:cudatext-folding-gutter-ctx-menu.png> "Enlarge")Code folding context menu, accessed from the gutter
936----
937-
938-"Folding" is the feature allowing to collapse (ie fold) multi-line blocks of code. Collapsed block usually shows the rectangle-like mark on the first line, and other block lines become fully hidden. Collapsed block can start from any column, but it consumes entire next lines. App shows special column in the "gutter" (vertical band with line numbers), with plus/minus icons - click on these icons collapses/uncollapses the corresponding block. Folding rules, about what blocks can be folded, are configured in the lexer file.
939-
940-There are several options to customize related functionality: to find them all, call menu item "Plugins / Options Editor Lite" and enter the dialog filter string "fold".
941-
942-Folded blocks can be shown in few different ways, see the option "fold_style":
943-
944- * rectangle-mark at the beginning of the range (maybe after some text in the line)
945- * rectangle-mark after the end of the first line of the range
946- * "− − −" dashed line below the first line of the range
947-
948-Clicks on the first partially folded line:
949-
950- * Click on the rectangle-mark does not unfold the block, because double-click must be handled. Double-click on the rectangle-mark selects the entire block (even if it's folded and user cannot see the selection).
951- * When option "fold_style" has value 0 to 2, clicking of the first partially folded line (out of rectangle-mark) unfolds the block. When "fold_style" has another value, click does not unfold the block, and user can mouse-select some part of the line.
952-
953-To select an entire folded block by keyboard, place the caret right before the beginning of the block, and press Shift+Down. Ie, make selection to the beginning of the next _unfolded_ line.
954-
955-### Gutter folding right-click menu
956-
957-Gutter's folding band supports right-click menu. It gives commands to fold/unfold all blocks which touch the right-clicked editor line. When it can be useful? For example, you have JSON file with line:
958-```
959-"data": [{
960-```
961-
962-Here you have outer block (square brackets) with inner block (curly brackets). Click on folding icon will fold the outer block. What if you want to fold the inner block? Right-click on gutter's folding band, and you will see the popup menu with menu items:
963-```
964-Line 6: "data": [{
965- Line 6: "data": [{
966-```
967-
968-Clicking the first item will fold/unfold the outer block, clicking the second item will fold/unfold the inner block.
969-
970-### Excluding of last line from folding
971-
972-Lexer JSON has special behaviour of folding, for such situations:
973-```
974-[
975- {
976- 1: 2
977- }, {
978- 3: 4
979- }, {
980- 5: 6
981- }
982- ]
983-```
984-
985-Try to fold first 2 blocks in this example. You see that last line of block is excluded from folding, it is a feature.
986-
987-Auto-excluding of last line works automatically. But for rare cases, it is needed to disable it. For example, Rainmeter lexer: its folding rules fits the criteria of last line excluding, but it is bad for the user. So last line excluding must be disabled manually for Rainmeter lexer. Setting exists in the file "data/lexlib/*.cuda-lexmap":
988-```
989-[op]
990- fold_exclude_line=0
991-```
992-
993-### Automatic folding of comments
994-
995-[![](/wiki-images/3/3e/cudatext-fold-comments.png)](</File:cudatext-fold-comments.png>) [](</File:cudatext-fold-comments.png> "Enlarge")Auto-folding of comments
996----
997-
998-There is an option "auto_fold_comments" (default is 0 - it's turned off) which allows to automatically create folding ranges from N (or more) consecutive lines, which are all "syntax comments" and/or "syntax strings". This works for both line-comments and stream-comments, they can be even mixed (one comment after another without blank lines in between, but not for several stream-comments on a single line). This works for multi-line string literals and for single-line string literals (single-line literals can go one after another without symbols in between, which is rarely supported by languages, but it occurs sometimes).
999-
1000-Which lexer literals are "comment"/"string"? This is setting of lexer, it is stored in the data/lexlib/*.cuda-lexmap file like this:
1001-```
1002-[comments]
1003- styles_cmt=Comment,Comment doc
1004- styles_str=Text,Tag string
1005-```
1006-
1007-There is also per-lexer setting to disable auto-folding for lexer, in the file "data/lexlib/*.cuda-lexmap":
1008-```
1009-[op]
1010- auto_fold=0
1011-```
1012-
1013-This setting is present for lexers:
1014-
1015- * Markdown
1016- * reStructuredText
1017- * MediaWiki
1018- * WikidPad
1019- * Textile
1020-
1021-ie for all lexers which support built-in Pascal tree-helpers. Because Pascal tree-helpers make folding ranges which conflict with auto-folding ranges.
1022-
1023-## Encodings
1024-
1025-You can change encoding of document by clicking on statusbar item, or by using menu "File / Encoding". Menu will give list of encodings. Menu gives 2 sub-menus:
1026-
1027- * "Reload as": Reload file in given encoding from disk.
1028- * "Convert to": Change encoding in memory only (this doesn't save the file).
1029-
1030-Possible encoding names for command-line usage:
1031-
1032- * utf8
1033- * utf8_bom
1034- * utf16le
1035- * utf16le_bom
1036- * utf16be
1037- * utf16be_bom
1038- * utf32le
1039- * utf32le_bom
1040- * utf32be
1041- * utf32be_bom
1042- * cp1250
1043- * cp1251
1044- * cp1252
1045- * cp1253
1046- * cp1254
1047- * cp1255
1048- * cp1256
1049- * cp1257
1050- * cp1258
1051-
1052- * cp437
1053- * cp850
1054- * cp852
1055- * cp861
1056- * cp865
1057- * cp866
1058- * cp874
1059- * shift-jis
1060- * gbk
1061- * cns
1062- * uhc
1063- * big5
1064- * gb2312
1065- * euc-kr
1066-
1067- * iso-8859-1
1068- * iso-8859-2
1069- * iso-8859-3
1070- * iso-8859-4
1071- * iso-8859-5
1072- * iso-8859-7
1073- * iso-8859-9
1074- * iso-8859-10
1075- * iso-8859-13
1076- * iso-8859-14
1077- * iso-8859-15
1078- * iso-8859-16
1079- * mac
1080- * koi8r
1081- * koi8u
1082- * koi8ru
1083-
1084-## Line ends
1085-
1086-All major types of line-ends are supported:
1087-
1088- * CR LF (usual for Windows)
1089- * LF (usual for Linux and Unix)
1090- * CR (usual for Mac OS 9, now almost not used)
1091-
1092-Mixed line-ends (LF with CR with CR LF) in one document are supported. Because of this feature, CudaText saves binary files to disk without corrupting them. To see mixed line-ends, use application option "unprinted_content", which can show text marks ("lf" etc) at line-ends.
1093-
1094-Commands:
1095-
1096- * To change line-ends for all lines in the current document, click statusbar cell for line-ends, menu will appear. You need to save file then. Changed line-ends can be undone via "Undo". Also 3 commands are available in the Command Palette.
1097- * To change line-ends for individial lines, use 3 commands in the Command Palette: "change line ends, for line(s) with caret: CR LF / LF / CR".
1098-
1099-# Additional indentation on Enter
1100-
1101-Some languages need that after pressing Enter, you make the additional indentation on the next line. For example, Python: it needs additional indentation after "def name():" and in some other cases. CudaText solves this via option "indent_auto_rule". Option must contain the regular expression which will be tested against the line on which you press Enter. CudaText ships predefined setting "indent_auto_rule" for several lexers: look at files "settings_default/lexer *.json".
1102-
1103-Example for Nim lexer. It needs indentation when you press Enter on a line ending with "=" or ":". And on a line with keywords "let", "var", "import". So write to the lexer-specific config "settings/lexer Nim.json":
1104-```
1105-{
1106- "indent_auto_rule": "^\\s*(let|var|import)$|.+[=:]$",
1107- }
1108-```
1109-
1110-Note for C-like lexers. Pressing Enter when caret is inside {} brackets (just after the brackets auto-pairing) - this is handled by CudaText specially, no option is needed here.
1111-
1112-# Groups of tabs
1113-
1114-"Groups" are sets of ui-tabs, where each ui-tab has attached editor control. By default only the first group is shown. Totally 6 "fixed" groups (located in the main app window) + 3 "floating" groups can be shown. Menu item "Split" allows to choose grouping mode:
1115-
1116- * One group
1117- * 2 groups: vertically or horizontally
1118- * 3 groups: vertically, horizontally or 1+2
1119- * 4 groups: vertically, horizontally or grid
1120- * 6 groups: vertically, horizontally or grid
1121-
1122-First group cannot be empty, at least one tab exists in it. Other groups can be empty: on closing last tab, if it's active, the first group activates.
1123-
1124- * You can drag-drop tabs from any group to any other visible group (drop only on tabs area).
1125- * You can move tabs to other groups (by group number or to the next/previous), using commands in tab headers context menu.
1126- * In grouping modes "2 groups" and "1+2" there's a context menu for splitter, to choose splitting 50/50, 40/60 etc.
1127- * On changing grouping mode, tabs from disappearing group(s) are moved to still visible group.
1128-
1129-3 "floating" groups are available, besides 6 "fixed" groups, they are inside separate windows (so can be moved to separate monitor). To move some ui-tab to floating group, call context menu over ui-tab title, choose menu item "Move tab to group / Floating n" (n = 1, 2, 3).
1130-
1131-If a "floating" group is focused, you should not click main window's menu items to perform commands. Instead, call commands by hotkeys. By clicking on the main window (for example: on the code-tree, when code-tree is in the main window), you move the focus to the "fixed" group and editor command will execute for the "fixed" group.
1132-
1133-# Auto-completion
1134-
1135-Command "auto-completion menu" (default hotkey: Ctrl+Space) shows auto-completion listbox.
1136-
1137-Command "go to definition" (default activation: see #Mouse_shortcuts), jumps to the declaration of the identifier under first caret.
1138-
1139-"Go to definition" and "auto-completion menu" require installed plugin (for example, "LSP Client" with configuration file "settings/lsp_xxxx.json"). If you did not install plugin yet - "go to defintion" does nothing, showing the error "No goto-definition plugin installed for this lexer" in the bottom statusbar.
1140-
1141-## IntelliSense
1142-
1143-Intelligent completion is supported via plugins. For the 2021 year, such plugins exist:
1144-
1145- * [[CudaText plugins|LSP Client]] \- supports Microsoft LSP protocol, for lot of languages. Plugin was tested to work good with servers: Python, C++, C#, CSS/SCSS/LESS, JavaScript/TypeScript, Go, Rust.
1146-
1147-And specialized plugins:
1148-
1149- * for Python lexer - "Python IntelliSense"
1150- * for HTML lexer - "HTML Completion", gives additional completion for "id" and "class" names
1151- * for AutoIt lexer - "AutoIt Helper"
1152- * for SPIR lexer - "SPIR Helper"
1153-
1154-In the case of files without lexer, consider to use plugins "Complete From Text" and "Intext Complete". They suggest completions from all words from the current document (or all opened documents, by option).
1155-
1156-## Static auto-completion files
1157-
1158-Some lexers (e.g. PHP, Pascal, Clojure) provide .acp files, which are fixed set of special words, to show in completion listbox. This is very simple completion, which ignores current context, it only suggests matching strings for the word (or string) under caret. These .acp files are stored in the folder "data/autocomplete".
1159-
1160-## Special HTML auto-completion
1161-
1162-Lexer HTML (and lexers with "HTML" in name, see the option "autocomplete_html_lexers") has its special logic, which is built-in in CudaText. It uses data files in the folder "data/autocompletespec" plus built-in code.
1163-
1164-Note: what is "tag", "attribute", "value" below? HTML lines has the form like:
1165-```
1166-<tag attribute1="value1" attribute2="value2" ...> some text </tag>
1167-```
1168-
1169-Completion listbox shows different information depending on context:
1170-
1171- * Caret is on empty space or after "<". Listbox shows list of tags.
1172- * Caret is on tag name (opening or closing). Listbox shows list of tags (beginning with typed tag).
1173- * Caret is after opening tag, before closing bracket, on empty space. Listbox shows list of tag's attributes.
1174- * Caret is on tag's attribute, before "=". Listbox shows list of attributes (beginning with typed attribute).
1175- * Caret is after tag's attribute, after "=". Listbox shows list of possible values of attribute, for fixed set of values.
1176- * Caret is inside attribute's quoted value. Possible cases:
1177- * Some tag/attribute with fixed set of values. Listbox shows list of possible values (beginning with typed value).
1178- * Tag A, attribute HREF. Listbox shows list of folders and all files (all files can be hyper-linked).
1179- * Tag LINK, attribute HREF. Listbox shows list of folders and CSS files.
1180- * Tag SCRIPT, attribute SRC. Listbox shows list of folders and JS files.
1181- * Tag IMG/INPUT, attribute SRC. Listbox shows list of folders and picture files.
1182- * Tag FRAME/IFRAME, attribute SRC. Listbox shows list of folders and HTML/PHP/ASP files.
1183- * Tag AUDIO, attribute SRC. Listbox shows list of folders and audio files (HTML supports few extensions).
1184- * Tag VIDEO, attribute SRC. Listbox shows list of folders and video files (HTML supports few extensions).
1185- * Tag SOURCE, attribute SRC. Listbox shows list of folders and audio+video files (code doesn't detect the outer tag: audio, video etc).
1186- * Caret is after '&' char with optional word-chars after '&'. Listbox shows HTML entities.
1187-
1188-[![cudatext-complete-pics.png](/wiki-images/e/e1/cudatext-complete-pics.png)](</File:cudatext-complete-pics.png>)
1189-
1190-About folders/filenames completion. Listbox items list depends on part of the quoted value before the caret. Folder/file names are taken from the folder/subfolder/up-folder of the current editor's document. Some examples, where caret is shown as "|".
1191-
1192- * Value "|end": All filenames.
1193- * Value "ab|end": Filenames beginning with "ab".
1194- * Value "bar/foo/|end": All filenames, from subfolder "bar/foo".
1195- * Value "../foo/bar/ab|end": Filenames beginning with "ab", from relative folder "../foo/bar".
1196-
1197-[![cudatext-complete-filenames.png](/wiki-images/9/9a/cudatext-complete-filenames.png)](</File:cudatext-complete-filenames.png>)
1198-
1199-To use auto-completion of CLASS= and ID= names (ie suggest mentioned names for partially typed names), you need the plugin "HTML Completion".
1200-
1201-## Special CSS auto-completion
1202-
1203-Lexer CSS (see the option "autocomplete_css_lexers") has its special logic, which is built-in CudaText. It uses data files in the folder "data/autocompletespec". Several possible cases are handled:
1204-
1205-1) Caret is inside {} brackets:
1206-
1207- * Caret is on CSS property name. Listbox shows list of properties (beginning with the typed value).
1208- * Caret is after CSS property and ":". If that CSS property has fixed set of values, listbox shows list of those values (beginning with the typed value).
1209- * Special case is "custom CSS properties", which start with double dashes, like "--my-var1". App supports completion of these names, when caret in inside "var()" function. App searches for all custom properties names mentioned in the current document.
1210-
1211-2) Caret is outside of {} brackets:
1212-
1213- * Caret is after tag name with char "@". Listbox shows list of CSS at-rules.
1214- * Caret is after tag name with char ":". Listbox shows list of CSS pseudo-elements, beginning with ":" and "::".
1215-
1216-3) Caret is in URL specifier (which is used to specify relative filename of a picture):
1217-```
1218-url(path|)
1219- url("path|")
1220- url('path|')
1221-```
1222-
1223-Listbox shows folder/file names, if "path" lefter than the caret contains valid partial path. Slashes must be forward ones. For example, url("./|") shows folders/files from the document's folder. For example, url("subdir/|") shows files/folders from the subfolder "subdir".
1224-
1225-## File URI auto-completion
1226-
1227-File URI is file path in the form like 'file://localhost/dir/filename' or 'file:///dir/filename' (host name 'localhost' is often missed). On Windows URI can look like 'file:///c:/dir/filename'.
1228-
1229-CudaText supports auto-completion for file URIs, when caret is on 'dir/filename' part, and file path exists on local user's PC.
1230-
1231-[![cudatext-complete-fileuri.png](/wiki-images/1/1a/cudatext-complete-fileuri.png)](</File:cudatext-complete-fileuri.png>)
1232-
1233-Auto-completion behaviour for this case is described in the topic about HTML completion, see "folders/filenames completion".
1234-
1235-# Code-Tree
1236-
1237-Code-tree is treeview UI control which shows list of document's 'symbols': classes/functions/structs/etc, from the lexer (only if lexer supports this). To show code-tree, activate the side-panel (default hotkey: F12). Many lexers support code-tree: most C-based, HTML, XML, CSS, JS etc. Example of tree for Pascal:
1238-
1239-[![atsynedit tree.png](/wiki-images/f/f8/atsynedit_tree.png)](</File:atsynedit_tree.png>)
1240-
1241- * Double-click on a tree node moves caret to its text.
1242- * Tree is filled after few seconds after file opening (search for options ui_tree* to change this pause).
1243- * When you move caret, tree shows tree node for caret position, after a pause (search for options ui_tree* to change this).
1244-
1245-Code-tree has the "filter" input field: when not empty, code-tree shows only items containing the filter text. This field also supports filtering by few **space-separated words**. There is also **Shift+Enter hotkey** in the filter field: it adds current filter string to the drop-down combobox history. Last entered filter strings are saved/restored to/from sessions.
1246-
1247-Code-tree has the context menu with items:
1248-
1249- * "Fold all"
1250- * "Unfold all"
1251- * "Fold level", 2 to 9
1252- * "Sorted": to toggle the alphabetical sorted mode of the tree
1253-
1254-Code-tree for CSS lexer has additional feature: in the "Colors" node, it shows colored preview-squares for HTML color-tokens - #AABBCC / #ABC / rgb(...) / rgba(...) / hsl(...) / hsla(...).
1255-
1256-[![cudatext-tree-css-colors.png](/wiki-images/d/d4/cudatext-tree-css-colors.png)](</File:cudatext-tree-css-colors.png>)
1257-
1258-# Console panel
1259-
1260-Panel is called by key Ctrl+tilde (Ctrl+`). It has read-only memo with output and edit field. You can type Python commands in the edit field, they will run and show output in the memo. E.g. enter "print(10+12)" and you'll see output "22". Can enter complex commands: e.g. "for i in range(10): print(i)".
1261-
1262-[![cudatext-console.png](/wiki-images/b/b2/cudatext-console.png)](</File:cudatext-console.png>)
1263-
1264- * If you enter command beginning with "=", then it's the same as you enterted "print()". E.g. command "=10+12" will give "22".
1265- * If you end command with ";", it won't be added to dropdown history.
1266- * Double-click on memo lines:
1267- * If line starts with ">>>", it repeats the old command (after ">>>" symbols).
1268- * For other lines, it runs "Navigate" context-menu command.
1269-
1270-You can enter commands from CudaText API. Example clears all bookmarks and sets bookmark on line 11 (these are several commands, run one by one):
1271-```
1272-from cudatext import *
1273- ed.bookmark(BOOKMARK_CLEAR_ALL, 0)
1274- ed.bookmark(BOOKMARK_SET, 10)
1275-```
1276-
1277-## How to use Console as calculator
1278-
1279-Call Console panel with Ctrl+` (Ctrl+tilde). In its input field, enter valid Python expressions with leading "=" char. To use "sin", "cos", "pi" etc, first enter command "from math import *".
1280-
1281-Example of 3 entered lines and their log in console:
1282-```
1283->>> from math import *
1284- >>> =pi
1285- 3.141592653589793
1286- >>> =100/5+2
1287- 22.0
1288-```
1289-
1290-# Command Palette
1291-
1292-Command Palette is a dialog which shows all embedded and external (plugin) commands in a single list. To call it, use hotkey Ctrl+Shift+P (or alias hotkey F1). To configure hotkey for some command in Palette, focus this command in listbox and press F9 - additional dialog will appear. CudaText remembers last chosen listbox item in the history file.
1293-
1294-Command Palette (and menu-like dialog in Python API) has the filter field. Filter supports fuzzy search, if the option "ui_listbox_fuzzy" is on. "Fuzzy" means that filter leaves only those listbox items, which contain all filter chars in ascending order. Example of fuzzy matches:
1295-
1296- * "fop" matches "file: open file"
1297- * "gttb" matches "goto text begin"
1298-
1299-If option is off, filter uses normal search. "Normal" means that filter leaves only those listbox items, which contain all words from the filter (in any order).
1300-
1301-Filter field can find hotkeys too. Enter only hotkey substring, with first "@" char. E.g. "@ho" finds "Ctrl+Home". This search is not fuzzy.
1302-
1303-Command Palette lists all internal CudaText commands, all plugin commands (prefixed with "plugin:"), all lexers (prefixed with "lexer:"), and currently opened files (prefixed with "opened file:"). Filter field allows to type hash symbol "#" followed by a letter, to make filtering by category:
1304-
1305- * #p - plugins
1306- * #l - lexers
1307- * #f - opened files
1308- * #r - recently used files
1309-
1310-You can type those "hash tags" at begin or end of the field, even without separating space. E.g. "bar#p" will show only plugin commands containing "bar", "#f.md" will show only Markdown files (with .md extension).
1311-
1312-# Regular expressions
1313-
1314-Lexer parser uses EControl regex engine. You use this regex syntax only in the "Lexer Properties" dialog in SynWrite, not in the CudaText normal usage. EControl regex has custom features:
1315-
1316- * class \A: begin of the document
1317- * class \Z: end of the document
1318- * class \l: Unicode word-char except the underscore char
1319- * class \L: inversion to \l
1320- * lookahead/lookbehind can find match of variable length
1321- * modifier (?r): \w catches all Unicode letters too
1322- * modifier (?g): greedy
1323-
1324-CudaText search/replace uses [TRegExpr engine](<https://regex.sorokin.engineer/en/latest/regular_expressions.html>) (by Sorokin, later improved by Alexey Torgashin).
1325-
1326- * To refer to regex groups in the regular expression itself, in the "Find what" field, use syntax \1 ... \9 and \0 for entire match.
1327- * To perform replacements with groups, in the "Replace with" field, use syntax $1 ... $9 and $0 for entire match. To use group 1 with following "00", use this: ${1}00.
1328-
1329-## Change case on replaces
1330-
1331-With regex, you can change case of found fragments, use modifiers in replace-with field:
1332-
1333- * \l - First char to lower
1334- * \L - All chars to lower
1335- * \u - First char to upper
1336- * \U - All chars to upper
1337-
1338-E.g. if found a word, use replace-with field "\L$0" to change word to lowercase (here $0 is group 0, found text).
1339-
1340-Modifiers affect only element after them, element is:
1341-
1342- * one char (not string), so "\Uabc" and "\uabc" give same result "Abc" (only one char changed),
1343- * or group $0 ... $9, so modifier changes case of this group (not only one char).
1344-
1345-# Output/Validate panels
1346-
1347-Output and Validate panels are embedded in the bottom panel, they can be shown by clicking their icons in the lower part of the sidebar. These panels allow to highlight (e.g. in blue) lines which match some RegEx. RegEx must be set by plugins which need that.
1348-
1349- * Plugin "External Tools" highlights the resulting lines in the Output panel, by setting the RegEx from the user tool's properties.
1350- * Plugin "HTML Tidy" uses Validate panel and sets RegEx for HTML Tidy resulting lines.
1351-
1352-Double-click is reserved in the Output/Validate panels - it is busy here for navigation from the clicked position to the source code. For example, "External Tools" plugin tries to perform this navigation when you double-click lines (even not highlighted lines).
1353-
1354-These panels have hotkeys:
1355-
1356- * Up/Down/PgUp/PgDown/Home/End: Move selection in list
1357- * Enter: Try to navigate to source file, like double-click
1358- * Esc: Focus the editor
1359- * Ctrl+Del: Clear the entire list
1360- * Ctrl+C: Copy to clipboard entire list
1361- * Ctrl+D: Copy to clipboard selected line
1362-
1363-# Dialog Find/Replace
1364-
1365-Find/Replace dialog has hotkeys, which work only when this dialog is focused. Hotkeys can be customized via options "find_hotkey_xxxx".
1366-
1367- * Alt+Enter: Find first
1368- * Enter: Find next / Replace next (depends of focused input)
1369- * Shift+Enter: Find previous
1370- * Ctrl+Enter: Add new line in multi-line input (multi-line mode is activated by "+" button)
1371- * Ctrl+Alt+Z: Replace and find next
1372- * Ctrl+Alt+Shift+Z: Replace and don't find next
1373- * Ctrl+Alt+A: Replace all occurrences
1374- * Ctrl+Alt+O: Count all occurrences
1375- * Ctrl+Alt+E: Select all occurrences
1376- * Ctrl+Alt+K: Mark all occurrences (with markers)
1377- * Ctrl+Alt+Q: Extract all RegEx matches
1378- * and hotkeys to toggle search/replace options (case sensitive, reg.ex., whole words etc)
1379- * additional not customizable hotkey Ctrl+Down: when input field (find-what or replace-with) is focused, hotkey copies the "find-what" text to "replace-with".
1380-
1381-[![cudatext-find-dlg.png](/wiki-images/2/2c/cudatext-find-dlg.png)](</File:cudatext-find-dlg.png>)
1382-
1383-Toggle-buttons have hotkeys too. Hover mouse over them to see floating tooltips about button functions.
1384-
1385-Toggle-buttons, ie options, are:
1386-
1387-Toggle-button ".*"
1388- Use "regular expressions" engine.
1389-Toggle-button "aA"
1390- Case sensitive search: "a" will be different from "A".
1391-Toggle-button "w"
1392- Search for whole words only, ie both sides of found match must be "word boundaries".
1393-Toggle-button "O"
1394- Wrapped search: search from beginning after reaching the end (with forward search), and search from end after reaching the beginning (with backward search).
1395-Toggle-button "[..]"
1396- Search in selection only.
1397-Toggle-button "+"
1398- Toggle multi-line mode for both dialog input fields. To add a newline in multi-line fields, press Ctrl+Enter.
1399-Toggle-button "*"
1400- Choose allowed syntax elements: Any / Only comments / Only strings / Only comments+strings / etc. This feature must be supported by lexer (and some lexers are limited, support only "comments" or only "strings" syntax elements). Syntax element is detected from left edge position of a found match.
1401-Toggle-button "Hi"
1402- Highlight all matches for the current search options. Matches are highlighted in the current editor, with the rounded borders, using the color of "SeparLine" syntax theme item. Editor auto-scrolls to the first found match (pretty much like ST3 editor). The limitation of this feature: a highlighted match has the single font color for the entire match, so if a match lays over several syntax tokens (e.g. number, dot, normal word), the entire match will have the single font color anyway.
1403-Toggle-button "Im"
1404- Immediate search, ie find-as-you-type. When checked, each typing in the "Find what" field finds next match in the editor (or the first match, if input was empty before typing).
1405-
1406-Toggle-buttons for "replace" mode:
1407-
1408-Toggle-button "?!"
1409- Show confirmation on each replace.
1410-Toggle-button "$0"
1411- "RegEx substitute for 'Replace with'". Activates "substitute" for replace-action. When option is off, the replate-with field is taken literally, without interpreting special constructs. When option is on, the replace-with field is processed for special constructs:
1412-
1413- * $0: Text of the whole found match
1414- * $1 ... $9: Text of the found RegEx group with the index 1...9
1415- * \n: NL char
1416- * \r: CR char
1417- * \t: TAB char
1418- * \f: FF char
1419- * \a: BEL char
1420- * \e: ESC char
1421- * \xNN, \x{NNNN}: hex code of char
1422- * \l: lower case of one char
1423- * \L: lower case of all text
1424- * \u: upper case of one char
1425- * \U: upper case of all text
1426-
1427-Toggle-button "AB"
1428- Preserve case on replacement. Mimics logic in VS Code program:
1429-
1430- * If the original string contains only upper-case or only lower-case characters, the result will be either all upper-case or all lower-case characters:
1431- * "ABCDE" -> replace with "xyz" -> "XYZ" (preserving all upper-case);
1432- * "abcde" -> replace with "xYz" -> "xyz" (preserving all lower-case).
1433- * The case of the first character in the original string is always preserved:
1434- * if it is upper-case, the first character in the result will be upper-case;
1435- * if it is lower-case, the first character in the result will be lower-case.
1436- * "Abcde" -> replace with "xyz" -> "Xyz" (preserving the first upper-case);
1437- * "abcde" -> replace with "Xyz" -> "xyz" (preserving the first lower-case).
1438- * In case of a mixed-case original string, the result follows the case of characters in the replacing string, excluding the very first character of the original string that always preserves its original case.
1439- * "ABcde" -> replace with "xyZ" -> "XyZ" (preserving the first upper-case);
1440- * "abCDE" -> replace with "XYz" -> "xYz" (preserving the first lower-case).
1441-
1442-Action buttons in dialog:
1443-
1444-Button "|<"
1445- Starts the search from document beginning, ignoring the caret position.
1446-
1447-Button ">"
1448- Finds next match, ie continues search forward.
1449-
1450-Button "<"
1451- Finds previous match, ie continues search backward.
1452-
1453-Button "..."
1454- Shows menu with additional actions:
1455-
1456-"Count all"
1457- Count all matches and show the number in the statusbar.
1458-"Extract RegEx matches"
1459- It's enabled only with RegEx option. Finds all matches, all found matches are put to an internal list, list is sorted, duplicates are discarded, and list is put to a new document. Plugin "Extract Strings" does the same task but using the Python RegEx engine.
1460-"Select all"
1461- Finds all matches in a document and places multi-seletions on them.
1462-"Mark all"
1463- Finds all matches in a document and places #Markers on them.
1464-
1465-Button "Replace"
1466- If some fragment was found/selected already, it replaces this fragment (by contents of "Replace with" field). If not, it finds next fragment and selects it. If replacement was performed, it finds/selects the next fragment.
1467-
1468-Button "Rep all"
1469- Performs replacement of all matches in the current document.
1470-
1471-Button "Rep global"
1472- Performs replacement of all matches in all opened documents in all editor groups. After showing the additional confirmation.
1473-
1474-The state of dialog search options is saved to the history file (settings/history.json), and is restored after app restart.
1475-
1476-Button "..." is enabled in "editor mode", so if button is disabled for you, it means CudaText was opened in #Text/Hex viewer mode. "Viewer mode" is activated when you pass the name of huge file with size>500 Mbytes (this is controlled by option "ui_max_size_open").
1477-
1478-## Text searcher features
1479-
1480-1) Search engine supports actions with multi-selections. This makes sense mainly for mass-search actions (Find all, Select all, Mark all, Replace all).
1481-
1482-2) Search engine has the feature, which is rarely implemented in text editors. When invoked on text selection(s) with the option "Search in selection only", engine doesn't place caret+selection on found match, instead it places marker (#Markers). The marker is placed with the underline (triangle with a line to the left), which shows the length of the found match. Actions "Find next"/"Find previuos"/"Replace" support "in selection only" too, they move that mentioned marker. Note that this feature checks the presence of a single marker in text, it may not work OK if you have some markers already placed.
1483-
1484-[![cudatext-find-markers.png](/wiki-images/7/74/cudatext-find-markers.png)](</File:cudatext-find-markers.png>)
1485-
1486-3) Second click on the "Search" sidebar button toggles dialog between Find and Replace modes.
1487-
1488-4) The "Replace all" action has one important feature: when find/replace options
1489-
1490- * regex
1491- * whole words only
1492- * in selection only
1493- * allowed syntax elements
1494- * confirm replaces
1495- * preserve case on replacement
1496-
1497-are all Off - app uses big optimization, making it a lot faster on huge lines. For example, replace of "\r\n" with linebreak char in huge line of length 20M with 900K occurrences: time without optimization in older CudaText versions: 15 mins --> now with optimization: 7 seconds.
1498-
1499-# "Go to line" and other "Go to" dialogs
1500-
1501-**Dialog "Go to line"** (item in the "Search" menu) allows to enter text in formats:
1502-
1503- * 10 (decimal number): Jump to given line number (to line start).
1504- * 10:10 (two decimal numbers): Jump to given line and column numbers.
1505- * 10% (decimal with trailing "%"): Jump to percents of total line count (to line start).
1506- * d100 (decimal with leading "d"): Jump to absolute decimal offset.
1507- * xFF00 (hex number with leading "x"): Jump to absolute hex offset.
1508- * value with leading/trailing "+": Extend selection to this position. For example: if caret is at the 2:2 and you enter "4:10+", editor makes selection from 2:2 to 4:10. Entering "4+" makes selection until start of line 4.
1509-
1510-Also it is possible to call "Go to line" dialog by clicking the statusbar's "caret information" cell (it is the first cell by default).
1511-
1512-**Other "Go to" dialogs.**
1513-
1514-1) Menu item "Search / Go to bookmark". Shows list of all bookmarks, in all opened documents, allows to jump to chosen bookmark.
1515-
1516-2) Project Manager plugin. Menu item "Plugins / Project Manager / Go to file". Shows list of all files in the current project, allows to jump to chosen file in the Project treeview. If option is enabled in the Project Manager, command will also open the chosen file in the editor.
1517-
1518-3) In the "Command Palette" dialog, enter #-char, and tooltip will appear in the Command Palette lower part. It tells how to call via Command Palette:
1519-
1520- * List of all opened documents with filenames.
1521- * List of recently opened filenames.
1522-
1523-4) Plugin CudaExt. Gives the command "Code Tree: Symbols list". It shows dialog with list of all symbols from the code-tree for the current document. Note: option "lexer_folding_max_lines" limits the count of document lines, for which code-tree is created. Plugin CudaExt gives 2 additional commands for symbols list: "... (only 1 up level)", "... (only 2 up level)" - they only show symbols from 1-2 top levels of the code-tree.
1524-
1525-# Sessions
1526-
1527-"Session" is a set of opened documents, with properties of each document. CudaText sessions are stored in JSON files with ".cuda-session" extension. Default session file name is "history session.json" in the "settings" folder. CudaText shows name of current session in its window title like "filename.txt {session_name} - CudaText".
1528-
1529-CudaText has options:
1530-
1531- * "ui_reopen_session": Save last session on closing, and restore it on start.
1532- * "ui_reopen_session_cmdline": Allow to restore last session even if some file/folder was passed in the command line (or from the Windows Shell Extension). Note, this gives weird behaviour: N program instances will reopen the same last session + passed command-line file. So this option is mainly for the single instance mode.
1533- * "ui_auto_save_session": On program closing, save current session without asking.
1534-
1535-If some session is opened, program stores document states, on program closing, to session file. If no session is opened, program stores document states to "history files.json" in the "settings" folder.
1536-
1537-Session file contains data:
1538-
1539- * List of named documents (file names), and unnamed documents
1540- * For each document:
1541- * kind of the document: text editor / picture viewer / text viewer (and viewer mode: text/binary/hex/unicode)
1542- * text of the document, if document is modified
1543- * undo/redo data, if document is modified
1544- * read-only state
1545- * first caret position
1546- * encoding
1547- * word-wrap mode
1548- * lexer
1549- * bookmarks
1550- * index of top visible line
1551- * tab size and "tab as spaces" state
1552- * minimap and micromap visible state
1553- * ruler visible state
1554- * non-printable characters visible state
1555- * line numbers visible state
1556- * scale factor
1557- * list of folded ranges (if lexer supports folding)
1558- * color of ui-tab (if not default)
1559- * tab title (if not default)
1560- * modified state
1561- * code-tree filter string and history of last filters
1562- * splitting to 2 editors: on/off, vertical/horizontal, percents of size
1563- * column of vertical "margin" line, if it's not default
1564- * For each modified document: date of modification, full document text
1565- * Last input of "Go to" dialog for each ui-tab
1566- * Layout:
1567- * Layout/sizes of side panel and bottom panel
1568- * Layout/sizes of editor groups
1569- * Index of active editor group and active tab in each group
1570-
1571-Plugin "Session Manager" is present in Addon Manager, it gives commands to control sessions: open session file, save session, show list of recent sessions, etc. Session Manager also supports files from SynWrite, with .synw-session extension.
1572-
1573-# Char map
1574-
1575-Dialog "Char map" can be called from the "Edit" top menu. It has 2 modes:
1576-
1577- * ANSI: Shows ANSI char codes from 0 to 255 (codes 128..255 map to different Unicode codes, this depends on active OS locale).
1578- * Unicode: Shows almost all Unicode code points, they are divided to groups. Change active group using combobox at the bottom.
1579-
1580-Click any cell in the grid to insert this char at caret position. Or select a cell with arrow keys and press Enter.
1581-
1582-[![cudatext-charmap.png](/wiki-images/b/bb/cudatext-charmap.png)](</File:cudatext-charmap.png>)
1583-
1584-# Tab switcher
1585-
1586-CudaText has option "ui_tab_switcher_dialog", which activates modern tab switcher for Ctrl+Tab hotkey. This is dialog which allows to switch tab using visit history. For example: press Ctrl, Tab, Tab, Tab, release Ctrl: this goes 3 steps back in the visit history. Visit history is updated on tabs activation (activated tab moves to the top of history).
1587-
1588-Dialog lists documents from all tab-groups, with prefixes: "[3-1] /home/user/filename.cpp" for 1st tab in 3rd group.
1589-
1590-[![cudatext-tab-switcher.png](/wiki-images/c/c1/cudatext-tab-switcher.png)](</File:cudatext-tab-switcher.png>)
1591-
1592-Alternative way is plugin CudaExt. Plugin gives the command "Choose tab to switch to". You need to assign hotkey Ctrl+Tab to this command (hotkey will be removed from built-in tab switcher). Plugin's dialog is richer than CudaText's dialog: it allows to switch to Console/Output/Validate panels, it allows to cancel the operation.
1593-
1594- * When plugin's switcher is called with pressed Ctrl-key, it shows the dialog.
1595- * When plugin's switcher is called without Ctrl-key pressed, it immediately switches to previous tab.
1596-
1597-[![cudatext-tab-switcher-cudaext.png](/wiki-images/5/54/cudatext-tab-switcher-cudaext.png)](</File:cudatext-tab-switcher-cudaext.png>)
1598-
1599-Command Palette has several commands to switch current ui-tab:
1600-
1601- * "ui: switch tab, to next": If option "ui_tab_switcher_dialog" is true, command shows menu-like dialog with suggestion to activate recent tab (using visit history). If option is off, command just activates the next ui-tab ignoring the visit history.
1602- * "ui: switch tab, to previous": If option "ui_tab_switcher_dialog" is true, the same as above. If option is off, command just activates the previous ui-tab ignoring the visit history.
1603- * "ui: switch tab, simply to next": Activates the next ui-tab, ignoring the visit history. (It considers only visual order of ui-tabs).
1604- * "ui: switch tab, simply to previous": Like above but in reverse order.
1605- * "ui: switch tab, to recent": Activates the ui-tab previously activated in visit history.
1606-
1607-# Minimap
1608-
1609-Minimap is wide vertical bar near editor's right side (it can be shown on the left side too, by option). To show it:
1610-
1611- * Set the option "minimap_show" (show permamently)
1612- * Use menu item "View / Toggle minimap" (show temporary, for the current document only)
1613-
1614-If you drag mouse over minimap, editor will scroll entirely from top to bottom, even for huge documents (mimics Sublime Text behaviour). Text in minimap is painted by pixels, not by font rendering. Minimap is scaled according to CudaText UI, but can be scaled separately too (option "minimap_scale"). Screenshot shows 2 windows with different minimap scale.
1615-
1616-[![cudatext-minimap.png](/wiki-images/3/3c/cudatext-minimap.png)](</File:cudatext-minimap.png>)
1617-
1618-CudaText UI-theme doesn't have separate color for minimap slider. CudaText calculates the color of slider (when slider is hovered by mouse): if text background color is light - slider color is darker by 5-10% (there is no option); if text background color is dark - slider color is lighter by 5-10%.
1619-
1620-Feature: for document line(s) affected by selection(s), minimap lines have additional full-width background coloring. This feature cannot be turned off yet.
1621-
1622-Feature: minimap rendering time is limited by 40 msec (no option for this yet). For rather slow CPU and maximized app window, the entire minimap rendering can take more time, so bottom minimap lines won't be colored at all.
1623-
1624-# Micromap
1625-
1626-Micromap is thin vertical bar near editor's right side. It is not scrollable, it shows overview of entire document from top to bottom. To show it:
1627-
1628- * set option "micromap_show": to show micromap permanently for all documents.
1629- * use menu item "View / Toggle micromap": to show micromap for the current document only.
1630-
1631-Micromap has several thin columns (from column 1 to column 3, but this can be changed by plugins) for different categories of marks. It shows:
1632-
1633- * full-width single mark: 'thumb', ie current visible area of editor.
1634- * on column 1 (leftmost): #Line_states marks.
1635- * on column 2:
1636- * marks from plugin Spell Checker (default color: reddish);
1637- * marks from plugin Highlight Occurrences (default color: blue); mark with UI-theme color "editor, line states, changed" means that it is "Highlight Occurrences" mark which corresponds to the current caret position (only for the first caret);
1638- * marks for bookmarks; these marks re-use UI-theme color "editor, line states, added".
1639- * on column 3: marks for selection(s), useful for example when command "Find / Select all" makes many selections.
1640-
1641-[![cudatext-micromap .png](/wiki-images/8/8e/cudatext-micromap_.png)](</File:cudatext-micromap_.png>)
1642-
1643-Plugins can place marks on micromap, e.g. plugin "Highlight Occurrences" places marks for highlighted fragments, plugin "Spell Checker" places marks for misspelled words.
1644-
1645-Micromap can be rendered directly on the vertical scrollbar (when scrollbar is application-painted). To use that, you need 2 options:
1646-
1647- * `"scrollbar_themed": true`
1648- * `"micromap_on_scrollbar": true`
1649-
1650-Picture shows micromap on the scrollbar: [![cudatext-micromap-on-scrollbar.png](/wiki-images/7/72/cudatext-micromap-on-scrollbar.png)](</File:cudatext-micromap-on-scrollbar.png>)
1651-
1652-Micromap visible state is not restored from history for files, which have line count bigger than value of option "wrap_enabled_max_lines" (default is 60K lines).
1653-
1654-In rather big documents (e.g. 2000+ lines), micromap renders the horizontal line near the bottom. What is this line? This line denotes the maximal position which you can click. Space below that line is 'reserved' for the micromap 'thumb'. 'Thumb' height is limited by 16 pixels, so last 16 pixels are reserved to render the 'thumb' nicely, when you scroll to the very bottom.
1655-
1656-# Paste with middle-button-click
1657-
1658-To paste like in Linux/Unix, with middle-click, you need:
1659-
1660- * Set option "mouse_middle_click" to value 2 (in the user.json).
1661- * Set option "auto_copy_clp". Option supports pasting to usual editors (inside UI-tabs) and also to one-line input fields (Find/Replace, Console, Code-Tree filter).
1662-
1663-# Full-screen mode
1664-
1665-There are two menu items in the View menu:
1666-
1667- * Toggle **Full-screen**. This maximizes app window (in a special way, OS-dependent, even OS taskbar hides), and also, optionally, turns off some UI elements: toolbar, statusbar, sidebar, side panels (Tree, Project, FTP), bottom panels (Console) etc. Option "ui_fullscreen" has set of chars, each char for one UI element to hide. E.g. option value "tp" hides 2 UI elements ("t" for toolbar, "p" for side panels).
1668- * Toggle **Distraction-free**. Like full-screen, but also all UI elements hide (gutter, statusbar, toolbar, sidebar, side panels). No option currently to configure which elements hide.
1669-
1670-Notes:
1671-
1672- * In the Distraction-free mode, app uses option "centering_for_distraction_free" to center the text visually. If you want this centering w/o Distraction-free mode, use the option "centering_width".
1673- * On macOS full-screen modes hide the top menu bar. To show it w/o returning back, just move the mouse cursor to the top of the screen and hold there for few seconds.
1674-
1675-# Python integration
1676-
1677-## Python on Windows
1678-
1679-On Windows, Python engine (2022/10: currently it is 3.8) is preinstalled. CudaText finds files "python3*.dll" in its folder, and uses file with the latest version number. No options exist to change this.
1680-
1681-You can use different Python version. From CudaText's Addon Manager, install appropriate package, e.g. "Windows_Python37_64bit", and restart the program.
1682-
1683-Python engine requires Visual C++ Redistributable for Visual Studio 2015 (32-bit or 64-bit, same as CudaText). Download it from Microsoft site.
1684-
1685-So, files needed for Python 3.8 are:
1686-
1687- * "python38.zip"
1688- * "python3.dll"
1689- * "python38.dll"
1690- * "python38dlls" - folder with about 18 *.pyd files
1691- * "vcruntime140*.dll" - Microsoft runtime
1692-
1693-File "python3.dll" without exact version: this file is sometimes needed for Python plugins to work property. For example, file is needed for plugin FTP with SFTP support (plugin crashes and shows errors in the Console if "python3.dll" is absent). Almost each package "Windows_Python3x_xxxx" contains this file.
1694-
1695-Note for Windows 7. You also need the Update for Universal C Runtime in Windows (KB2999226). Download it from the Microsoft site.
1696-
1697-## Python on Windows XP
1698-
1699-Install the package "Windows Python34 32bit". Download it from [SourceForce folder addons/packages](<https://sourceforge.net/projects/cudatext/files/addons/packages/>), and unzip to CudaText folder.
1700-
1701-No options are needed to configure this older Python, but you need to delete all newer Pythons from CudaText folder:
1702-
1703- * python*.dll: must be deleted
1704- * python*.zip: can be left as is
1705- * files *.pyd: can be left as is
1706-
1707-Proper old version of "requests" is now included in the "Windows Python34 32bit". But if you miss it somehow, do additional steps:
1708-
1709- * New versions of "requests" lib don't work, ie Addons Manager crashes. So you need to downgrade the "requests" lib. Get old version 2.5.x from <https://pypi.org/project/requests/#history> and update the folder "py/sys/requests".
1710- * After you downgrade the "requests", you may get Addons Manager errors about HTTPS certificate. To fix that, replace outdated file "py\sys\requests\cacert.pem" with the new one from "py\sys\certifi\cacert.pem".
1711-
1712-## Python on Linux, BSD, Solaris
1713-
1714-Linux/*BSD/Solaris version uses Python library from OS. Install Python 3.x (usually already installed). Instruction, if Python library was not automatically used:
1715-
1716- * Open file manager, go to /usr
1717- * Search for "libpython3.*so*"
1718-
1719-Or use the terminal command:
1720-```
1721-$ find /usr -name 'libpython3.*so*' 2>/dev/null
1722-```
1723-
1724- * If not found, install Python 3.x, and search again.
1725- * Set option "pylib__linux" ("pylib__freebsd", "pylib__solaris") in the "user.json" config, to one of the found filenames. Write option to the "user.json" or course, not "default.json".
1726-
1727-Typical value for Ubuntu:
1728-```
1729-"pylib__linux" : "/usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0",
1730-```
1731-
1732-Typical value for Solaris 11.4 x86:
1733-```
1734-"pylib__solaris" : "/usr/lib/amd64/libpython3.5m.so",
1735-```
1736-
1737-## Python on macOS
1738-
1739-On macOS you must install Python 3, from official site python.org. Versions 3.6...3.12 are OK. CudaText will detect this Python. CudaText has option "pylib__mac" with such default value (actual version number is auto-detected):
1740-```
1741-"pylib__mac": "/Library/Frameworks/Python.framework/Versions/3.5/lib/libpython3.5.dylib",
1742-```
1743-
1744-macOS 15 and newer: some users report that the above path was changed to:
1745-```
1746-"pylib__mac": "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/libpython3.9.dylib",
1747-```
1748-
1749-If you use Homebrew to install Python on MacOS, CudaText cannot detect it, so you need to write to the "user.json" option "pylib__mac" by hands. Example:
1750-```
1751-"pylib__mac": "/usr/local/Cellar/python@3.9/3.9.1_3/Frameworks/Python.framework/Versions/3.9/lib/libpython3.9.dylib",
1752-```
1753-
1754-If you use "virtualenv" from Anaconda with isolated Python, CudaText cannot detect it, so you need to write to the "user.json" option "pylib__mac" by hands. Example:
1755-```
1756-"pylib__mac": "/miniconda2/envs/py3/lib/libpython3.7m.dylib",
1757-```
1758-
1759-Note: Please remember to change your version in the variable string to match the version you have installed.
1760-
1761-# Line states
1762-
1763-In the gutter bar, you can see colored thin bars next to line numbers: greenish, yellowish. It is line states. They show state of lines:
1764-
1765- * normal: they have no special color on gutter
1766- * changed: edited since last saving
1767- * added: newly inserted lines
1768- * saved: previously changed/added but saved on last saving
1769-
1770-[![cudatext-line-states .png](/wiki-images/2/26/cudatext-line-states_.png)](</File:cudatext-line-states_.png>)
1771-
1772-Line states help to see which lines were edited since the last opening of a file / last saving of a file. CudaExt plugin gives few commands for line states:
1773-
1774- * "Jump: to next/previous changed lines"
1775- * "Jump: to next/previous working lines"
1776- * "Jump: to next/previous saved lines"
1777-
1778-# How to change icons
1779-
1780-Screenshot shows 3 icon sets at once:
1781-
1782- * on the main toolbar (horizontal)
1783- * on the sidebar (vertical)
1784- * on the Project Manager toolbar (horizontal, below "Project" text)
1785-
1786-[![cudatext all icons.png](/wiki-images/1/14/cudatext_all_icons.png)](</File:cudatext_all_icons.png>)
1787-
1788-**Icons on the main toolbar**
1789-
1790-To change them:
1791-
1792- * (Optional) Install add-on(s) of kind "toolbar theme" (each add-on gives additional icon set or several sets).
1793- * Change option "ui_toolbar_theme" in user.json. Option value is some subfolder in data/toolbaricons.
1794- * Restart CudaText.
1795-
1796-Note that plugin "Options Editor Lite" makes it easy - for options "ui_toolbar_theme"/"ui_sidebar_theme"/"ui_tree_theme" it shows the combobox dropdown, which is easy to change.
1797-
1798-**Icons on the sidebar**
1799-
1800-To change them:
1801-
1802- * (Optional) Install add-on(s) of kind "sidebar theme".
1803- * Change option "ui_sidebar_theme" in user.json. Option value is some subfolder in data/sideicons.
1804- * Restart CudaText.
1805-
1806-**Icons on the Project Manager toolbar**
1807-
1808-To change them:
1809-
1810- * (Optional) Install add-on(s) of kind "proj toolbar theme".
1811- * Change option in the dialog: "Options / Settings-plugins / Project Manager / Config".
1812- * Restart CudaText.
1813-
1814-**Icons in the Project Manager file list**
1815-
1816-[![cudatext-project-icons.png](/wiki-images/b/bf/cudatext-project-icons.png)](</File:cudatext-project-icons.png>)
1817-
1818-To change them:
1819-
1820- * Install add-on(s) of kind "file type icons".
1821- * Change option in the dialog: "Options / Settings-plugins / Project Manager / Config".
1822- * Restart CudaText.
1823-
1824-**Icons on UI-tab titles**
1825-
1826-[![cudatext-tab-icons.png](/wiki-images/9/98/cudatext-tab-icons.png)](</File:cudatext-tab-icons.png>)
1827-
1828-You must install plugin "Tab Icons" from Addons Manager. It will show icons on UI-tabs (only for known file types). Plugin also allows to set custom icons for UI-tabs. Use right-click menu over UI-tab, and menu item "Set tab icon...". This shows menu with predefined custom icons, shipped with "Tab Icons" plugin. You can add *.png 16x16 icons there too, folder is "(CudaText)/data/tabsicons" (create folder if needed).
1829-
1830-**Icons in the Code-Tree panel**
1831-
1832-[![atsynedit tree.png](/wiki-images/f/f8/atsynedit_tree.png)](</File:atsynedit_tree.png>)
1833-
1834-To change them:
1835-
1836- * Install add-on(s) of kind "codetreeicons" (each add-on gives additional icon set).
1837- * Change option "ui_tree_theme" in user.json. Option value is some subfolder in data/codetreeicons.
1838- * Restart CudaText.
1839-
1840-# Toolbar
1841-
1842-CudaText has toolbar on the top, which can be shown by menu item "View / Toggle toolbar".
1843-
1844-[![cudatext-toolbar.png](/wiki-images/f/f5/cudatext-toolbar.png)](</File:cudatext-toolbar.png>)
1845-
1846-To customize it, install plugin "Config Toolbar" from Addon Manager. Plugin gives command (menu "Plugins / Config Toolbar / Customize buttons") to customize toolbar contents: simple buttons, buttons with dropdown menus, separators, icons for buttons.
1847-
1848-Plugin also gives command "Hide standard buttons" which allows to hide default CudaText buttons from toolbar. This command shows input box for space-separated indexes of buttons. What are these indexes? Indexes are 0-based numbers of all toolbar items: first button (New File) is index 0, next item (dropdown near New File) is index 1, next item (Open File) is index 2, etc (all separators also have index). So for example, to hide 3rd + 10th items, enter "2 9" into that input box.
1849-
1850-# Configurable statusbar
1851-
1852-Statusbar is fully configurable: you can change order/visibility of cells, width and alignment of cells. Option "ui_statusbar_panels" configures set of cells. Predefined cells are:
1853-
1854- * **Carets info**. Click on it shows Go To dialog.
1855- * **Encoding name**. Click on it shows menu to change encoding of document.
1856- * **Line-ends characters**. Click on it shows menu to change line-ends in entire document.
1857- * **Lexer name**. Click on it shows lexers menu.
1858- * **Tab-char size**. Shows "Tab: 4" if Tabulation-key inserts tab-char, or "Spaces: 4" if Tabulation-key inserts spaces. Click on it shows menu:
1859- * To change tabulation size (for the active document).
1860- * To change mode "Tabulation-key inserts spaces".
1861- * 2 items for actions "Convert indentation to spaces", "Convert indentation to tabs" like in Sublime Text.
1862- * **Text insert/overwrite mode** , toggled by Ins-key. Shows "Ins" or "Ovr".
1863- * **Mouse selection mode** : "-" for normal mode, "||" for column mode (mouse dragging makes column selection even without Alt+ key).
1864- * **Message** from program or plugins (usually it's last auto-sized cell).
1865- * **Word-wrapping mode**. Cell is hidden by default. Shows one of possible 3 modes:
1866- * No wrapping.
1867- * Wrapping at window edge.
1868- * Wrapping at fixed margin (set it by "margin" option).
1869- * **Font zoom value** in percents. Cell is hidden by default.
1870-
1871-The cell "carets info" shows value of one of options:
1872-
1873- * **"ui_statusbar_no_sel"** : Used when there is no selection
1874- * **"ui_statusbar_small_sel"** : Used when there is single-line selection
1875- * **"ui_statusbar_str_sel"** : Used when selection is multi-line
1876- * **"ui_statusbar_col_sel"** : Used for column-selection mode
1877- * **"ui_statusbar_carets"** : Used when 2 or more carets are placed
1878-
1879-In the above "ui_statusbar_" options, macros are supported:
1880-
1881- * {y}: line index of first caret
1882- * {y2}: line index of last caret
1883- * {yb}: line index of first selection beginning
1884- * {ye}: line index of first selection ending
1885- * {x}: column index of first caret, tab-chars counted as 1
1886- * {xx}: column index of last caret, tab-chars expanded
1887- * {count}: total number of lines
1888- * {carets}: total number of carets
1889- * {sel}: number of lines affected by selection(s)
1890- * {selchars}: number of selected characters, for all kinds of selections
1891- * {cols}: number of columns in column selection
1892- * {char}: character at first caret (empty if no char)
1893- * {char_dec}: character at first caret - decimal code (empty if no char)
1894- * {char_hex}: character at first caret - 2...4-digit hex code (empty if no char)
1895- * {char_hex4}: character at first caret - 4-digit hex code (empty if no char)
1896- * {_ln}: localized string "Ln"
1897- * {_col}: localized string "Col"
1898- * {_sel}: localized string "sel"
1899- * {_linesel}: localized string "lines sel"
1900- * {_carets}: localized string "carets"
1901-
1902-An option exists to change the delay of messages in the statusbar.
1903-
1904-This is not used in the main statusbar, but plugin API allows to colorize statusbar cells (used by Vim Mode plugin), and to show icons there.
1905-
1906-# Text/Hex viewer
1907-
1908-CudaText has internal file viewer, for files on unlimited size. Viewer is based on different component: not ATSynEdit but ATBinHex. Viewer loads into memory only visible portion of file, so viewer is fast for files of any size. To activate the viewer for normal small text files, use these Command Palette commands:
1909-
1910- * file: open file, in text viewer
1911- * file: open file, in hex viewer
1912- * file: open file, in unicode viewer
1913- * plugin: Cuda-Ext: File: Show in hex viewer (this command is from CudaExt plugin)
1914-
1915-Viewer component supports several modes:
1916-
1917- * Text mode: 1-byte encoding, variable line length
1918- * Binary mode: 1-byte encoding, fixed width (line breaks are ignored)
1919- * Hex mode: 1-byte encoding, fixed width
1920- * Unicode mode: like Text, but in UTF-16 encoding
1921- * Unicode/Hex mode: like Hex, but in UTF-16 encoding
1922-
1923-Combined screenshot shows the different modes in action: Text, Binary, Hex, Unicode.
1924-
1925-[![cudatext-viewer-modes.png](/wiki-images/5/5c/cudatext-viewer-modes.png)](</File:cudatext-viewer-modes.png>)
1926-
1927-CudaText suggests to use viewer for files of too big size (bigger than option "ui_max_size_open"). And for files with binary contents.
1928-
1929-[![cudatext-viewer-asking.png](/wiki-images/7/7e/cudatext-viewer-asking.png)](</File:cudatext-viewer-asking.png>)
1930-
1931-Viewer has only limited search support, ie not all Find-dialog options are enabled, when file viewer is active. Viewer allows to use "Go to" dialog. In the "Go to" dialog, you can enter "2000" to jump to hex offset 0x2000 (in hex mode, rounded to 16 bytes). If you enter "50%", viewer will jump to the middle. Viewer supports selection of block by mouse, and hotkeys Ctrl+A (Select all), Ctrl+C (Copy to clipboard). Viewer supports double-click to select whole word.
1932-
1933-In viewer mode, you can click statusbar fields:
1934-
1935- * Encoding field. You can change viewer encoding only in non-Unicode modes.
1936- * Mode field, to change view mode: Text, Binary, Hex, Unciode, Unicode/Hex.
1937-
1938-**Q: How to open file in viewer?**
1939-
1940-A1: If file is too big, CudaText suggests to use viewer automatically - see screenshot of the helper dialog above. If file is not too big, you can switch from the editor to viewer. You need the plugin CudaExt which gives the Command Palette command: **"Cuda-Ext: File: Show in hex viewer"**. After that, you can change viewer-mode via statusbar click: Text / Binary / Hex / etc. To switch back to the editor, use Command Palette command: **"Cuda-Ext: File: Show in text editor"**.
1941-
1942-A2: Start CudaText without any files, and call Command Palette item **"file: open file, in text viewer"**. It shows the Open File dialog and then loads file directly into viewer. Again, you can change viewer-mode via statusbar click: Text / Binary / Hex / etc.
1943-
1944-A3: Start CudaText from Terminal (console) like this:
1945-```
1946-cudatext -z=text FileName
1947- cudatext -z=binary FileName
1948- cudatext -z=hex FileName
1949-```
1950-
1951-# Picture file viewer
1952-
1953-CudaText has the emdedded picture file viewer. Picture mode is activated for files with several known extensions:
1954-
1955- * BMP
1956- * PNG
1957- * JPEG, JPG
1958- * GIF
1959- * ICO (Windows icon)
1960- * WEBP, it requires libwebp library: on Windows it is file libwebp32.dll / libwebp64.dll in the CudaText folder; on Linux/Unix it is file libwebp.so.6 in system folder
1961- * PSD (Photoshop image)
1962- * TGA (Targa)
1963- * CUR (Windows cursor)
1964-
1965-Viewer supports zooming of an image:
1966-
1967- * use Ctrl + mouse wheel
1968- * click the statusbar cell with the zoom value, and choose one of predefined zoom values: 33%, 50%, 100%, 150%, 200%, 500%, 1000%, 1500%.
1969-
1970-While picture is zoomed so that it's bigger than the current window, you can drag the picture by mouse.
1971-
1972-While picture viewer is active, Find/Replace dialog is disabled.
1973-
1974-# Pair brackets
1975-
1976-CudaText has built-in pair bracket finder. Bracket finder can highlight pair brackets, when there is only single caret, and no selection is placed. It finds symbols "()[]{}<>" (configurable per lexer via lexer-specific configs). Bracket finder respects lexer context: it skips symbols inside syntax "comments" and syntax "strings". If caret is placed not directly on/after a bracket, program will find nearest surrounding brackets.
1977-
1978-(Long time ago, plugin "Bracket Helper" was needed for this feature, later it was removed from add-ons.)
1979-
1980-There are several options:
1981-
1982- * "bracket_highlight"
1983- * "bracket_symbols" (includes only symbols ()[]{} by default, but you can enable symbols <> for example in HTML lexer specific config)
1984- * "bracket_distance"
1985- * "auto_close_brackets"
1986-
1987-There are several commands in the Command Palette:
1988-
1989- * brackets: pair highlight: on
1990- * brackets: pair highlight: off
1991- * brackets: pair highlight: toggle
1992- * brackets: jump to pair
1993- * brackets: select to pair
1994- * brackets: select to pair, inside (it makes selection smaller by 2 characters)
1995-
1996-## Brackets auto-pairing logic
1997-
1998-Auto-pairing of brackets is controlled by the option "auto_close_brackets". Option supports auto-pairing of brackets and some other chars (quotes, tilde etc).
1999-
2000-**For single caret**
2001-
2002- * If selection is present, and opening bracket is typed, CudaText encloses the selection into 2 paired chars, like "(selection)".
2003- * If there is no selection, and char is typed (not only bracket-char, but any char from the option), CudaText inserts 2 paired chars like "()", moving the caret inside that pair. Incorrect contexts for the pairing are:
2004- * Context "\|" - caret is after backslash.
2005- * Context "|w" - char after caret is not one of :;.,=>.
2006- * Context "w|" - quote-char (single quote, double quote, backtick) is typed after a word-char.
2007- * If there is no selection, and closing bracket is typed, CudaText may ignore this char or not, it depends on context:
2008- * Context "f(|)" - app ignores closing bracket and only moves caret righter.
2009- * Context "f(text|)" - new closing bracket is added.
2010-
2011-**For multi-carets**
2012-
2013-CudaText first looks at contexts of all carets. If at least one caret has "not suitable" context, app does not do the pairing, for all carets. So pairing is performed for all or nothing.
2014-
2015-For caret with selection, context is considered as OK. And typed char will enclose the selection for that caret.
2016-
2017-## Auto-deletion of pair brackets
2018-
2019-BackSpace key supports deletion of both brackets at once. Only for bracket chars listed in the "bracket_symbols" option. It is supported when all carets have the 'good situation', ie this (caret is shown by "|"):
2020-```
2021-(|)
2022- [|]
2023- {|}
2024-```
2025-
2026-or this, with additional spaces:
2027-```
2028-(| )
2029- [| ]
2030- {| }
2031-```
2032-
2033-When all carets have this 'good situation', BackSpace deletes both brackets at once. When at least one caret does not have the 'good situation', BackSpace performs usual deletion of single character on the left.
2034-
2035-# Word jump commands
2036-
2037-CudaText provides several word-jump commands, see them in the Command Palette by entering "go to word":
2038-
2039- * go to word next
2040- * go to word next + select
2041- * go to word next, simple
2042- * go to word next, simple + select
2043- * go to word previous
2044- * go to word previous + select
2045- * go to word previous, simple
2046- * go to word previous, simple + select
2047- * go to word end
2048- * go to word end + select
2049-
2050-"Go to word next" vs "Go to word end"?
2051-
2052- * "...next" - jumps to the next word start (left word boundary).
2053- * "...end" - jumps to the end of the current word (right word boundary), and after that it jumps to the next word end too.
2054-
2055-For example, Windows 7 Notepad performs "...next" on pressing Ctrl+Right, while Sublime Text 3 performs "...end" on pressing Ctrl+Right. To configure Ctrl+Right (and Shift+Ctrl+Right) behaviour, re-assign this hotkey from one command to another - to reassign it, press F9 in the Command Palette dialog.
2056-
2057-"Go to word next" vs "Go to word next, simple"?
2058-
2059- * "..., simple" command performs simplified jump, it treats all alpha-numerical characters and symbols (#$%^&@ etc) as one group, so it makes single jump over "test@#some!" string.
2060- * "Go to word next" treats alpha-numericals and symbols as different char groups, and stops at the beginning of each group.
2061-
2062-Plugin CudaExt provides such related commands:
2063-
2064- * Cuda-Ext: Jump: Left into CamelCase/snake_case
2065- * Cuda-Ext: Jump: Right into CamelCase/snake_case
2066-
2067-# Sorting and finding duplicate lines
2068-
2069-CudaText has two sorting methods.
2070-
2071-**Method 1: Plugin "Sort"**. It supports Undo for its commands. It works not fast and takes lot of memory on sorting. It cannot sort some huge files, because it reads document contents from Pascal memory buffer to Python memory buffers.
2072-
2073-Commands in the menu "Plugins / Sort" and in the Command Palette:
2074-
2075- * Sort ascending
2076- * Sort descending
2077- * Sort ascending, ignore case
2078- * Sort descending, ignore case
2079- * Sort dialog... (shows all sorting options in dialog)
2080- * Reverse lines
2081- * Shuffle lines
2082- * Remove duplicate lines
2083- * Remove duplicate lines, but keep blanks
2084- * Remove duplicate lines + origins
2085- * Remove adjacent duplicate lines (ie nearest repeated lines)
2086- * Extract duplicate lines (put duplicate lines to a new document)
2087- * Extract duplicate lines, ignore case
2088- * Extract unique lines
2089- * Remove blank lines
2090- * Remove adjacent blank lines
2091- * Ini file: sort sections and keys
2092- * Ini file: sort sections, but not keys
2093- * Sort e-mail list by domain (lines should be valid email addresses to sort them by domain)
2094-
2095-The advantage of "Sort" plugin is that is has additional commands (for duplicate lines, for ini files, for e-mails).
2096-
2097-Plugin has config file, you can edit it via menu item "Options / Settings-plugins / Sort". In the section [sort] you can change option "allow_sort_all_when_none_selected" to 0 or 1 to disable/enable sorting of entire document, if nothing is selected. If selection exists (single selection), plugin handles only selected lines.
2098-
2099-**Method 2: Pascal-based sorting commands** , which are named in the Command Palette like "(without undo) sort...". They clear current Undo (ie user cannot undo sorting operation), but they are optimized for speed and memory. Commands don't read document contents into additional buffers, they sort lines in-place (changing pointers only). So these commands work with any files which CudaText can load.
2100-
2101-Commands in the Command Palette are:
2102-
2103- * (without undo) sort ascending
2104- * (without undo) sort ascending, ignore case
2105- * (without undo) sort descending
2106- * (without undo) sort descending, ignore case
2107- * (without undo) delete all blank lines
2108- * (without undo) delete adjacent blank lines
2109- * (without undo) delete all duplicate lines
2110- * (without undo) delete all duplicate lines, keep blanks
2111- * (without undo) delete adjacent duplicate lines
2112- * (without undo) reverse lines
2113- * (without undo) shuffle lines
2114-
2115-These built-in commands handle only the range of selected lines, if selection exists (only first selection is handled).
2116-
2117-# Markers
2118-
2119-"Markers" are text positions which are shown with red (color in default theme) triangles below them. CudaText gives such commands in the Command Palette:
2120-
2121- * "markers: drop marker at caret": Adds a marker on current caret position.
2122- * "markers: go to last marker (don't delete)": Moves caret to the last placed marker without deleting it.
2123- * "markers: collect last marker (delete)": Moves caret to the last placed marker and deletes it.
2124- * "markers: remove all": Removes all markers in the current document.
2125- * "markers: swap caret and last marker": Moves caret to the last placed marker, deletes this marker, and adds marker on the previous caret position. Command is to jump to the last marker, second command call jumps back, 3rd command call jumps back, etc.
2126- * "markers: select to last marker": Makes text selection from caret position to the position of last placed marker.
2127- * "markers: delete to last marker": Deletes text from caret position to the position of last placed marker.
2128-
2129-Markers are utilized by the Snippets plugin.
2130-
2131-[![cudatext-markers-html.png](/wiki-images/2/29/cudatext-markers-html.png)](</File:cudatext-markers-html.png>)
2132-
2133-Snippets plugin finds tab-stops in the inserting snippet text, and places markers for them. After markers are placed by Snippets plugin, Tab-key works in special way - it runs command "collect last marker", ie it jumps to the next marker ("next" by the order of tab-stop: 1, 2, 3... tab-stop 0 is the last). When user collects all markers by Tab-key, this special mode deactivates and Tab-key works as usual again. Command "markers: remove all" also deactivates that mode.
2134-
2135-Note about command "Add next occurrence of selected word". This command finds next occurrence, and adds marker (with underline) for the last added selection. This marker is special: it's intended only for this command, and it's auto-removed on a) "Cancel carets" command, b) any text changing, c) mouse click. The reason for this marker is to support "wrapped" search: command runs "wrapped" search when it reaches the document end.
2136-
2137-# Dialog "Save tabs"
2138-
2139-Dialog "Save tabs?" shows on CudaText closing, if at least one document is modified and not saved to disk. Dialog lists all modified file-tabs (usually one file per one file-tab, but it's allowed to have 2 files in a single file-tab). Checkmarks (all checked by default) are used to check/uncheck file-tabs which will be saved on pressing "Save" button. For untitled documents to be saved, program will show "Save as" prompts. Button "Don't save" closes dialog and program, losing modifications. Button "Cancel" closes the dialog, but not the program.
2140-
2141-CudaText has the option "ui_reopen_session". When it is true, dialog "Save tabs?" shows additional button: "Don't save / Keep in session", which doesn't save disk files, but stores modified documents to active "session" file. Program will read it on start.
2142-
2143-Also CudaText gives the command "dialog: save tabs" in the Command Palette. It shows the same dialog, the difference is that buttons do not close the program.
2144-
2145-# Hex display of special chars
2146-
2147-Editor shows some characters in a "hex form", like "x2000" for character U+2000. For codes below 0x100, hex form is shorter, like "x01" for character U+0001. If single-byte encoding is used (e.g. cp437), then only the short hex form is used. Hex form is rendered with different font color.
2148-
2149-[![cudatext-hex-chars.png](/wiki-images/8/80/cudatext-hex-chars.png)](</File:cudatext-hex-chars.png>)
2150-
2151-Special characters which are always rendered in the hex form (this is not configurable):
2152-
2153- * U+0000...U+001F, except Tab-char U+0009
2154- * U+2000...U+200F: white spaces + specials
2155- * U+2028...U+202F: white spaces + specials
2156- * U+2066...U+2069
2157- * U+0085
2158- * U+061C
2159- * U+FEFF
2160-
2161-# Tabs features
2162-
2163-Control of UI tabs is named ATTabs, and has many features:
2164-
2165- * Pseudo-tab "+" at the end. Option "ui_tab_show_plus".
2166- * Scrolling arrows (on the left by default), to scroll tabs when there are lot of them and they don't fit. Thin scrolling indicator auto-appears on the top (default color is red).
2167- * Drop-down arrow (on the right by default), to show menu of all tabs in the current group.
2168- * Tabs can be placed on all 4 sides: top, bottom, left, right. Option "ui_tab_position".
2169-
2170-[![cudatext-tabs-left .png](/wiki-images/c/c8/cudatext-tabs-left_.png)](</File:cudatext-tabs-left_.png>)
2171-
2172- * Layout of "arrows" is customizable. Option "ui_tab_button_layout". Button "+" is available, to replace "+" pseudo-tab, this button is always visible (pseudo-tab can be scrolled away). Button "x" is available, to close the current tab. Screenshot shows the layout with all possible buttons placed on the left.
2173-
2174-[![cudatext-tabs-layout.png](/wiki-images/f/f2/cudatext-tabs-layout.png)](</File:cudatext-tabs-layout.png>)
2175-
2176- * Tabs can be multi-line. In multi-line mode, tabs-control changes its own height. But this height is limited by 2/3 of the window height. Option "ui_tab_multiline".
2177-
2178-[![cudatext-tabs-multiline.png](/wiki-images/4/41/cudatext-tabs-multiline.png)](</File:cudatext-tabs-multiline.png>)
2179-
2180- * Tabs can have fixed or variable width. "Variable width" means that tabs are auto-stretched to fit the longer title. Option "ui_tab_variable_width". Minimal/maximal width of fixed tabs is customizable.
2181-
2182- * Tabs can be shaped/bordered, or can be flat. Option "ui_tab_flat". Flat tabs are painted with additional colored underline for the active document.
2183-
2184-[![cudatext-tabs-flat.png](/wiki-images/9/92/cudatext-tabs-flat.png)](</File:cudatext-tabs-flat.png>)
2185-
2186- * Tabs can be dragged by mouse: inside original group or to another groups (to show another groups use "Split" top menu item). And can be moved to specified group index using tab context menu items "Move tab to group n".
2187- * Program can be used without tabs at all. Options "ui_tab_show" and "ui_tab_disabled".
2188-
2189- * Tabs can be colored, by calling tab's context menu, and "Set tab color..." menu item. Internally, it calls plugin cuda_palette to choose the color, then color is applied. Plugin dialog has several modes (even simplest mode named "60 colors" is enough). By default, only thin line at the edge of tabs is colored, but you can colorize the entire tab using CudaText option "ui_tab_fullcolor". Coloring is saved to session (tab color is usual property of editor).
2190-
2191-[![cudatext-tab-colors.png](/wiki-images/e/ea/cudatext-tab-colors.png)](</File:cudatext-tab-colors.png>)
2192-
2193- * Tabs can have file-type icons, if plugin "Tab Icons" is installed (icons are preinstalled already, they are used by Project Manager). Plugin also allows to assign icons from additional set of 16x16 PNG files.
2194-
2195-[![cudatext-tab-icons.png](/wiki-images/9/98/cudatext-tab-icons.png)](</File:cudatext-tab-icons.png>)
2196-
2197- * Tabs can show "path suffix" when there are several tabs for the same base filename. In the example picture, we have opened files "t.txt" from 3 different folders, and tabs show that folders after a bullet-char. Feature can show "path suffix" for up to 4 folder levels.
2198-
2199-[![cudatext-tabs-path-suffix.png](/wiki-images/f/f1/cudatext-tabs-path-suffix.png)](</File:cudatext-tabs-path-suffix.png>)
2200-
2201- * When too many tabs are opened, so that they don't fit by width/height:
2202- * the left/right "arrow" icons become working, they scroll the tabs-control;
2203- * the reddish "scroll marker" appears at the edge of the tab-control. Picture shows 2 windows with the scroll marker: one with single-line tabs, another is with multi-line tabs.
2204-
2205-[![cudatext-tabs-red-marker.png](/wiki-images/c/cc/cudatext-tabs-red-marker.png)](</File:cudatext-tabs-red-marker.png>)
2206-
2207- * Tabs can be made "pinned" using tab's context menu item "Pinned". Pinned tab caption renders with a "!" prefix char. Commands "Close all tabs" and "Close other tabs" skip pinned tabs. Closing of a pinned tab shows additional confirmation like "Tab is pinned... Are you sure you want to close it?".
2208-
2209-# Activating internet links
2210-
2211-CudaText allows to activate internet links (URLs) and e-mails (e-mail can be with the '[mailto:'](<mailto:'>) and without it). This feature needs that links are automatically underlined in the editor. After the double-click on an underlined link, editor shows small button over the link (button with caption "Open link" or "Send e-mail"), and clicking on this temporary button activates the link.
2212-
2213-[![cudatext-click-link.png](/wiki-images/2/2e/cudatext-click-link.png)](</File:cudatext-click-link.png>)
2214-
2215-This works with the default values of 2 options:
2216-
2217- * "links_regex": it must include RegEx, which detects and underlines links
2218- * "mouse_click_links": it gives choices:
2219- * don't activate links by clicks
2220- * activate by single click
2221- * activate by double click
2222-
2223-# HTML color codes underlining
2224-
2225-CudaText can colorize HTML color codes, which have these forms:
2226-
2227- * #abc
2228- * #abc0
2229- * #aabbcc
2230- * #aabbcc00
2231- * rgb(100, 200, 100)
2232- * rgba(100, 200, 100, 0.5)
2233- * hsl(0, 100%, 50%)
2234- * hsla(0, 100%, 50%, 0.5)
2235-
2236-Two options configure this feature:
2237-
2238- * "underline_color_files": Specifies which file extensions are supported by the feature.
2239- * "underline_color_size": Specifies the size of colored block in the editor area. It can be simple underline below the color code, or a background highlighting. Background highlighting can be in 2 variants: for entire text, for the fragment inside brackets.
2240-
2241-Screenshot shows all 3 variants in different CudaText windows:
2242-
2243-[![cudatext-color-underline.png](/wiki-images/1/1a/cudatext-color-underline.png)](</File:cudatext-color-underline.png>)
2244-
2245-# UI scaling
2246-
2247-UI can be scaled by these options:
2248-
2249- * "ui_scale" (needs suffix for OS): it scales the sizes of UI controls only.
2250- * "ui_scale_font" (needs suffix for OS): it scales fonts sizes only (both editor text font and UI font).
2251-
2252-Auto-detection of current OS scale is implemented for Windows only. And you can ignore the Windows scale auto-detection, by setting the above options.
2253-
2254-Additional options are:
2255-
2256- * "ui_tab_scale": it scales UI-tabs font, independent from other options.
2257- * "minimap_scale": it scales minimap only, independant from other options.
2258- * "unprinted_symbols_scale": it scales graphics rendered for non-printable stuff: spaces, tabs, EOL text markers.
2259-
2260-If you scale UI, you may want to scale the icons as well. But icons are PNG images and cannot be resized, so the solution here is additional icon sets. In the menu "Plugins / Addons Manager / Install" you will find several categories of icon sets:
2261-
2262- * category "sidebartheme" - configured by option "ui_sidebar_theme"
2263- * category "toolbartheme" - configured by option "ui_toolbar_theme"
2264- * category "codetreeicons" - configured by option "ui_tree_theme"
2265- * category "projtoolbaricons" - configured by dialog of Project Manager
2266- * category "filetypeicons" - configured by dialog of Project Manager
2267-
2268-# Themed top menu
2269-
2270-Top menu (together with some context menus and menu from the "hamburger" icon) can be themed. Only on Windows. This needs the option `"ui_menu_themed":true` (it's 'true' by default). When option is on, menu font/background/selection/checkmarks become colored from other CudaText UI theme colors. Also, option "ui_menu_themed_font_size" allows to change the font size.
2271-
2272-You can also set colors of menu elements directly; dialog "Options / Themes / Settings - theme - ui" provides theme items for this. For example, to set the font-color of the top menu, change the color of element "top menu, font" in the dialog.
2273-
2274-[![cudatext-menu-colorsetup.png](/wiki-images/d/dd/cudatext-menu-colorsetup.png)](</File:cudatext-menu-colorsetup.png>)
2275-
2276-By default, elements "top menu, ...." in the dialog have the "none" color (crossed rectangles), it means that actual colors are taken from other UI-theme elements:
2277-
2278- * "top menu, font" - falls back to element "tabs, font"
2279- * "top menu, font, hotkey" - falls back to element "top menu, font" and then to element "tabs, font, modified tab"
2280- * "top menu, font, disabled state" - falls back to element "tabs, passive tab border"
2281- * "top menu, BG" - falls back to element "tabs, active tab BG"
2282- * "top menu, BG, selected" - falls back to element "tabs, mouse-over tab BG"
2283-
2284-# Margins
2285-
2286-CudaText gives 2 options to render vertical lines in specified columns:
2287-
2288- * "margin": Integer value, column of "normal margin" vertical line. This margin is used also by the word-wrapping, then "wrap_mode" option is 2 or 3. It is also used by CudaExt plugin's action(s) ("Re-wrap lines by margin").
2289- * "margin_string": String of space-separated numbers, it makes vertical lines appear at additional columns.
2290-
2291-The plugin "Column Marks" adds more features:
2292-
2293- * Commands to set the "normal margin" and/or "additional margins" via prompt dialog. Plugin can save entered value to the user.json config.
2294- * Commands to move the caret though all margin columns (normal + additional), to the left/right.
2295-
2296-# Add-ons
2297-
2298-## How to disable plugins
2299-
2300-If file "plugin_disabled" (contents is ignored) exists in the plugin's folder (near install.inf), then plugin will be ignored.
2301-
2302-## Entire plugins list
2303-
2304-See the [GitHub repository](<https://github.com/halfbrained/cudatext_plugins_list>) with the readme and links about almost all published plugins. You can make Pull-Request there, if needed.
2305-
2306-## Kinds of add-ons
2307-
2308-plugins
2309- Extensions with Python code. They add events and/or commands. Commands can be called then via "Plugins" top menu, but only if plugin's install.inf file doesn't hide menu items in "Plugins". In any case, all commands can be called via Command Palette dialog.
2310-
2311-lexers
2312- Syntax highlighting files. For ex, Arduino lexer adds item "Arduino" to the lexer menu. Some addons can add 2 or more lexers, for ex "HTML nnnnnn" addons often add 2 lexers: one is visible in the lexer menu, another one is hidden (it supports embedded blocks).
2313-
2314-linters
2315- Sub-plugins for CudaLint plugin. Each supports some lexer (or several similar lexers). To use them, install CudaLint plugin, open your work file, and call CudaLint commands: it calls appropriate linter and shows colored bookmarks on error/warning lines.
2316-
2317-formatters
2318- Sub-plugins for CudaFormatter plugin. Each supports one or several lexers and can reformat source code for these lexers. Examples: Python ReIndent, JS Sort Imports, AStyle Format.
2319-
2320-tree helpers
2321- Plugins which show Code-Tree structure and/or folding, for some lexers. For the following lexers tree-helpers are built-in (ie written in Pascal): Ini (lite lexer "Ini files ^"), Markdown, MediaWiki, reStructuredText, WikidPad, Textile.
2322-
2323-snippets_ct
2324- Collections of text fragments, for "Snippets" plugin (which is required to use snippets). See details in the [[CudaText plugins|CudaText_plugins#Snippets]].
2325-
2326-translations
2327- CudaText UI translations. For ex, JP translation changes all menuitems + dialogs to JP language. Dialogs of plugins are not affected.
2328-
2329-plugintranslation
2330- Translation of plugin strings to different languages. This includes translation of strings from Python code, and strings from "install.inf" files.
2331-
2332-themes
2333- UI/syntax themes for the "Options / Themes / Select color theme..." dialog. "UI" themes change colors of CudaText interface. "Syntax" themes change colors of text in syntax highlighted files.
2334-
2335-Icons
2336-
2337-
2338-sidebar themes
2339- Icon sets for the sidebar (vertical row of buttons on the left side).
2340-
2341-
2342-
2343-toolbar themes
2344- Icon sets for the main toolbar (horizontal row of buttons on the top).
2345-
2346-
2347-
2348-toolbar x icons
2349- Icon sets for plugin "Config Toolbar", for user-added buttons.
2350-
2351-
2352-
2353-file type icons
2354- Icon sets for the file list of "Project Manager" plugin. Usually these are repackaged icons for VS Code editor.
2355-
2356-
2357-
2358-proj toolbar icons
2359- Icon sets for the toolbar of "Project Manager" plugin.
2360-
2361-
2362-
2363-code-tree icons
2364- Icon sets for the Code-Tree (icons are visible in the Code-Tree with some lexers, e.g. C#).
2365-
2366-build systems
2367- Configuration files for different external tools, for the Runner plugin. Runner plugin supports build-systems for Sublime Text 3 (only JSON configs, without support for additional Python codes).
2368-
2369-packages
2370- Packages with possible binary files, which will be unpacked to the CudaText installation folder. For the date 2021.08, these are only Python engines, for CudaText Windows build.
29+**ed**
30+
31+Main editor field.
32+
33+**gut**
34+
35+Gutter, contains several columns for the active editor: bookmark icons, line numbers, folding icons, line-state marks.
36+
37+**tabs**
38+
39+UI-tabs, to switch between different documents.
40+
41+**map**
42+
43+Mini-map (left side), which is shown here together with micro-map (thin bar on the right side).
44+
45+**tree**
46+
47+Code-tree, shows 'symbols' from the active document (functions, classes, structs etc) in the tree view.
48+
49+**filt**
50+
51+Filtering input field for the code-tree. Leaves only those items which contain entered text.
52+
53+**tb**
54+
55+Toolbar: buttons for some commands. Hidden by default. Configurable via plugin Config Toolbar.
56+
57+**sb**
58+
59+Sidebar. Vertical bar with buttons to activate different parts of the **side panel** : Code-Tree (built-in), Project Manager (plugin), Snippet Panel (plugin) etc. Sidebar buttons on the bottom half activate parts of the **bottom (horizontal) panel** : Console panel, Output panel etc. Plugins can add buttons to sidebar, for example the bottom black icon is the ExTerminal plugin.
60+
61+**cons**
62+
63+Console. One of the bottom panels. You can activate others (Output and Validate panels) via sidebar.
64+
65+**stat**
66+
67+Statusbar. Has several cells to show some current states.
68+
69+**bre**
70+
71+Breadcrumb bar, clickable filepath entries provided by an optional [plugin](<https://github.com/CudaText-addons/cuda_breadcrumbs>) available in the Addons Manager.
72+
73+## Configuration
74+
75+The CudaText configuration system uses JSON files: call menu item "Options | Settings - default" and you'll see the default configuration file `default.json`. Copy lines from this file to the file `user.json` displayed by selecting the menu item "Options | Settings - user" and edit the values there to customize your user configuration. The `user.json` is the actual configuration file, the default configuration is provided solely to use as a reference.
76+
77+![Light bulb](https://upload.wikimedia.org/wikipedia/commons/d/d8/Nuvola_apps_ktip.png) **Note:** You can copy the JSON comments from the default file into your user configuration, too. In the user config, include useful lines inside the curly braces `{ }`, this is JSON formatting. Trailing commas on the final key:value pair before a closing brace (`}`) are allowed here.
78+
79+**Default config**
80+
81+File `settings_default/default.json`, can be opened via menu item "Options | Settings - default". CudaText doesn't use this file, it's only for user reference. CudaText only opens this file by the command, and this file is parsed by plugin "Options Editor Lite".
82+
83+**Hotkeys (keyboard shortcuts) config**
84+
85+File `settings/keys.json`. Special dialog allows to change all hotkeys in CudaText. You should not edit this file directly, without using the dialog. Dialog is called from "View | Command palette" by pressing `F9`. Dialog allows to set primary+secondary hotkeys for any command (except dynamically added commands which, for example, change current lexer).
86+
87+**Plugin configs**
88+
89+Files `settings/cuda_*`. Plugins store their settings in there, and files can be in any format (most commonly JSON or INI). Good quality plugins provide menu items in "Options | Settings - plugins" to open their config file, or to show configuration dialog.
90+
91+**History files**
92+
93+Files `settings/history*.json`. Don't edit them. Mentioned here because sometimes users need to delete their history files (dialog positions, recent files list etc, recent search strings etc).
94+
95+**User config**
96+
97+File `settings/user.json`. Can be opened via menu item "Options | Settings - user".
98+
99+**User lexer-specific configs**
100+
101+Files `settings/lexer NNN.json`. It is layer which is read after user config, when user activates some lexer. E.g. if you open C file, config file `lexer C.json` is read. You should not write `ui_` options to lexer-specific configuration files (they may produce weird effects when changing lexers), and some other global options.
102+
103+ * For (None) lexer, config file is named `lexer -.json`.
104+ * For lite lexers, configuration filenames are appended with a circumflex, e.g. `lexer XML ^.json`
105+
106+**Default lexer-specific configs**
107+
108+Files `settings_default/lexer NNN.json`. It is layer which is read after user config, but before lexer specific config. CudaText provides several such files, with useful defaults.
109+
110+**Lexer-specific hotkeys configs**
111+
112+Files `settings/keys lexer NNN.json`. Each such config contains hotkeys for one lexer only.
113+
114+### File types
115+
116+_Example configuration blocks in_ `user.json` { … "detect": { "*.mht": "HTML", "myconfig.conf": "Nginx", ".profile": "Bash script", }, … }
117+---
118+{ … "detect_line": { "<html.*": "HTML", "<!DOCTYPE.*": "HTML", "<\\\?xml.*": "XML", }, … }
119+
120+The key:value pairs in the `"detect"` object in `user.json` specify mappings from filename to lexer name.
121+
122+ * Each key name represents a single mask or several ';'-separated masks. Masks can be "foo", "*foo", "foo*", "*.foo", "*.foo.bar" etc.
123+ * Each key value must map to a lexer name. A value of `-` prevents all automatic lexer activation.
124+
125+Another method to specify these mappings is the "Lexer properties" dialog where you can add extension or name+extension assignments to a specific lexer, however it has limitations; notably, since it saves the custom mappings to the lexer file itself (located in `data/lexlib/lexername.lcf`), those settings will be erased upon re-installation of the lexer or (if it is among the preinstalled lexers) updating to a new version of CudaText.
126+
127+### Language detection by first line regex
128+
129+The key:value pairs in the `"detect_line"` object in `user.json` create rule definitions that trigger lexer activation based on the contents of the first line of a file.
130+
131+ * Key name: A case-sensitive (you can use the `(?i)` modifier to disable case-sensitivity) regular expression evaluated using the first line of the file. Note that this is a regular expression using syntax similar to [PCRE](<http://www.wikipedia.org/wiki/Perl_Compatible_Regular_Expressions> "wikipedia:Perl Compatible Regular Expressions"), so for example the `#` character must be escaped with a backslash, and instead of a simple `*` filemask, you must use `.*`. Also note that the current implementation cannot handle forward slashes "/" well, so escape them or use a `.` wildcard instead.
132+ * Key value: Lexer name. As noted earlier, a value of `-` means "don't activate a lexer".
133+
134+CudaText has several default values:
135+```
136+"<\?xml .+": "XML",
137+ "\#!\/bin\/(ba)?sh": "Bash script",
138+ "\#!\/usr\/bin\/env (ba)?sh": "Bash script",
139+ "\#!\/usr\/bin\/env python\d*": "Python",
140+ "\#!.*\b(node|js|bun|osascript\s+-l\s+JavaScript)": "JavaScript",
141+```
142+
143+### Plugins menu custom groupings
144+```
145+{
146+ …
147+ "plugin_groups": {
148+ "CSS .+": "Web",
149+ "HTML .+": "Web",
150+ "JS .+": "Web",
151+ "Config.+": "Config",
152+ "Option.+": "Config",
153+ },
154+ …
155+ }
156+```
157+
158+The "plugin_groups" object in `user.json` allows configuring custom groupings in the Plugins menu, e.g. putting all "HTML …" and "CSS …" menu items into a "Web" submenu. For example:
159+
160+ * Key name: A regular expression for the top level of the menu name, e.g. if the menu name in a plugin's `install.inf` is `CSS Utils\Misc\Action`, the top level is `CSS Utils`.
161+ * Key value: The group name; the `\` character provides the ability make nested sub-menus.
162+
163+### Location of 'settings', 'py', 'data' folders
164+
165+CudaText distributions are portable, if the executable file is located near the "data" sub-folder. So the distribution for Windows is portable (executable "cudatext.exe" is located near "data"), and distributions from .xz archives are portable too.
166+
167+Not portable CudaText:
168+
169+ * Linux: .deb package, which installs binary file to `/usr/bin/cudatext` and several data folders to `/usr/share/cudatext`.
170+ * macOS: package, which installs to the "Applications" system folder.
171+ * Haiku.
172+
173+For not portable usage, folder "settings" is created here:
174+
175+ * Linux, *BSD, Solaris: `~/.config/cudatext`, or `${XDG_CONFIG_HOME}/cudatext` if that environment variable is set
176+ * macOS: `~/Library/Application Support/CudaText`
177+ * Haiku: `/boot/home/config/settings/cudatext`
178+
179+## Command line flags/arguments
180+
181+Usage:
182+```
183+cudatext [ flag … ] filename …
184+```
185+
186+Supported flags:
187+
188+**`-h`/`--help`**
189+
190+Show command-line help and exit.
191+
192+**`-v`/`--version`**
193+
194+Show application version and exit.
195+
196+**`-z= value`**
197+
198+Open files from command-line in internal viewer, using given viewer mode:
199+
200+ * `-z=text` — Text mode with variable line length, single-byte encodings
201+ * `-z=binary` — Text mode with fixed line length, single-byte encodings
202+ * `-z=hex` — Hexadecimal mode, single-byte encodings
203+ * `-z=unicode` — Text mode with variable line length, UTF-16 LE/BE encodings
204+ * `-z=uhex` — Hexadecimal mode, UTF-16 LE/BE encodings
205+
206+**`-r`**
207+
208+Open files from command-line in read-only mode.
209+
210+**`-n`**
211+
212+Ignore option "ui_one_instance", and open new app window.
213+
214+**`-nsl`**
215+
216+Don't load last session on start.
217+
218+**`-nss`**
219+
220+Don't save last session on exit.
221+
222+**`-ns`**
223+
224+Shortcut to "-nsl" together with "-nss".
225+
226+**`-nh`**
227+
228+Don't load saved file history (caret, selection, scroll position, etc.).
229+
230+**`-nn`**
231+
232+Don't suggest to create new file if command-line filename is not found.
233+
234+**`-e= value`**
235+
236+Open all files from command-line in given encoding.
237+
238+**`-el`**
239+
240+Show possible encoding names and exit.
241+
242+**`-s= folder`**
243+
244+Specify full path of the "settings" folder, which contains all configuration files.
245+
246+**`-i`**
247+
248+Read the contents of stdin to a new document (Linux-only). It can be used in a Linux shell like: `ls -l | cudatext -i`
249+
250+**`-verbose`**
251+
252+Copy Python messages from Console panel to stdout (Linux-only).
253+
254+**`-id= name`**
255+
256+Set a "group" for single-instance mode, so that an instance of "group1" will not interfere with instances of "group2". The default id is `cudatext.0`. Note: this switch is not supported on Windows.
257+
258+**`-w= left|top|width|height`**
259+
260+Set the position/size of the main window. Up to 4 numbers can be specified, and any number can be skipped to keep its previous value.
261+
262+**`-c= cuda_module,method_name`**
263+
264+Run the specified command plugin on startup. The command plugin is only applied to the currently active editor tab, so make sure you don't pass multiple filenames in the command line, and that the current session doesn't have multiple files. It is often used along with the `-n` and/or `-ns` flags. Need to learn the name of a "cuda_module"? It is the name of subfolder under the "py" folder. Likewise, to discover the "method_name" look for the value of the `method=` key in the `py/cuda_module/install.inf` file.
265+
266+**`-p= cuda_module#param1#param2…`**
267+
268+Run the specified plugin, and pass to its "on_cli" event the specified param strings. The number of params must be expected by the plugin, e.g. the Differ plugin supports "on_cli" and expects two filenames. If params contain spaces, you must double-quote that entire command-line flag beginning with -p, as in `"-p=…"`.
269+
270+**Notes:**
271+
272+ * Filenames can be passed with suffix (at the end of each filename) specifying the line/column numbers for the initial placement of the caret: `@line` or `@line@column`
273+ * Folders can be specified too, they will be opened as a "project" in the Project Manager.
274+ * Project files (`*.cuda-proj`) can be loaded from the command line.
275+ * Non-existing filename can be specified, CudaText will ask if you wish to create the file.
276+ * File masks with the `*` wildcard are supported, e.g. `cudatext test/t*.htm*` will work.
277+ * Zip filenames can be specified, if they are zipped CudaText add-ons (zip file must contain "install.inf" in proper format).
278+
279+On macOS, you cannot run "cudatext" from the Terminal out of the box, but you can create an alias "cudatext" like this: `alias cudatext=open\ /Applications/CudaText.app\ --args`
280+
281+## Mouse shortcuts
282+
283+![Light bulb](https://upload.wikimedia.org/wikipedia/commons/d/d8/Nuvola_apps_ktip.png) **Note:** For macOS, use the `Cmd ⌘` key instead of the `Ctrl` key in all of the mouse shortcuts listed below.
284+
285+[![](/wiki-images/a/a7/atsynedit-carets.gif)](</File:atsynedit-carets.gif>)
286+
287+[](</File:atsynedit-carets.gif> "Enlarge")
288+
289+Multi-carets in action
290+
291+### Multi-carets
292+
293+Multi-carets are several carets at once. All carets work together for many editing commands: caret moving, text typing, deleting, selection with keyboard.
294+
295+ * `Ctrl`+Left click - Add/remove caret.
296+ * `Ctrl`+Middle click - Add/remove caret.
297+ * `Ctrl`+Left click and drag - Add caret with selection.
298+ * `Ctrl`+`⇧ Shift`+Left click - Add column of vertically-aligned carets, from the previous caret position to the clicked line.
299+
300+Dragging
301+
302+ * `⎇ Alt`+drag - Make **column selection**.
303+ * Drag on Gutter line numbers - Select text by entire lines.
304+ * Double left-click and immediately drag - Select text by words.
305+
306+Clicks
307+
308+ * Double left-click - Select clicked word; this behavior can be customized as described in **§ How to select extra symbols by double-click** using the `nonword_chars` option.
309+ * Triple left-click - Select entire line (block is limited by newline characters).
310+ * Middle-click - Configurable by option `mouse_middle_click`, choices are:
311+
312+ 0. **(0)** Nothing.
313+ 1. **(1)** Start "browser scrolling" mode: circle mark appears and mouse moving around this mark auto-scrolls text in 4 directions; speed of scrolling depends on distance of cursor from circle mark (any click to turn off).
314+ 2. **(2)** Paste from clipboard. This mimics Linux apps behaviour.
315+ 3. **(3)** Call "Go to definition" command.
316+
317+ * Click on Back/Forward mouse buttons - These clicks do nothing by default, but they produce keyboard actions BrowserBack/BrowserForward (extended keys on Windows keyboards), and so they can be assigned in the hotkeys setup dialog (`F9` in the Command Palette). For example, `Ctrl`+Back produces `Ctrl`+BrowserBack keyboard action.
318+
319+Miscellaneous
320+
321+ * `⇧ Shift`+`⎇ Alt`+Left-click - Make vertical (column) selection, from the first caret to the clicked position.
322+ * `⇧ Shift`+Scroll mouse wheel - Scroll text horizontally.
323+ * `Ctrl`+Scroll mouse wheel (with option `mouse_wheel_zoom: true`) - Zoom text in/out.
324+ * `Ctrl`+Scroll mouse wheel (in the picture viewer) - Zoom picture in/out.
325+ * `⇧ Shift`+Left-click on gutter line number - Select lines, from first caret position to the index of clicked line.
326+
327+Drag-drop of selected text block
328+
329+ * Dragging inside single document: if `Ctrl` is pressed during the drop (you should press `Ctrl` after dragging is started), block will be copied (not moved) to the pointed position.
330+ * Dragging to a different document (see **§ Groups of tabs**): if `Ctrl` is pressed during the drop, block will be moved (otherwise it will be copied).
331+
332+The command "Go to definition" can be called by different mouse shortcuts: by `Ctrl`+`⎇ Alt`+Left-click (default), `⎇ Alt`+Left-click, etc.; this depends on the `mouse_goto_definition` option.
333+
334+## Multi-selections
335+
336+[![](/wiki-images/b/b7/atsynedit-sel.gif)](</File:atsynedit-sel.gif>)
337+
338+[](</File:atsynedit-sel.gif> "Enlarge")
339+
340+Multi-selection feature
341+
342+If you place a caret with `Ctrl`+Left-click, the caret has no selection, whereas if you add a caret with `Ctrl`+Drag, the caret will have a selection. You can add selections to carets later, by `⇧ Shift`+`◀`/`▲`/`▼`/`▶`/`Home`/`End`, etc.
343+
344+Multi-selections are handled specially on copy/paste. If you copy selections, then move carets, then paste, paste will insert clipboard lines into carets: line-1 at caret-1, line-2 at caret-2 etc (only if carets count equals to lines count in clipboard, otherwise result is different).
345+
346+### Commands with selections
347+
348+Clipboard commands work with multi-carets and multi-selections the special way. Also "Delete char" commands (`Del ⌦`/`⌫ Backspace` keys) works the special way.
349+
350+Command | Behaviour with no selections | Behaviour with at least one selection
351+---|---|---
352+Copy to clipboard | Copies entire lines, containing carets. Ignores multiple carets on a same line. | Copies only selections text. Ignores carets without selections.
353+Cut to clipboard | Similarly to "Copy" without selections. | Similarly to "Copy" with selections.
354+Paste from clipboard | First, selections are cleared (deleted). Then, command pastes text into each caret position. Special case is when clipboard lines count equals to carets count - in this case, first line is inserted at first caret, second line is inserted at 2nd caret, etc.
355+Delete char left (Backspace) / Delete char right | Deletes one char at each caret position. | Deletes only selections text. Ignores carets without selections.
356+
357+## Lexers
358+
359+[![](/wiki-images/2/2f/cudatext-lexer-library.png)](</File:cudatext-lexer-library.png>)
360+
361+[](</File:cudatext-lexer-library.png> "Enlarge")
362+
363+CudaText lexer library
364+
365+Syntax highlighters in CudaText are called _lexers_ , and are compatible with the SynWrite editor (which is frozen). The Lexer engine itself is borrowed from [EControl.ru](<http://www.econtrol.ru/syntedit.html>), with modifications by Alexey Torgashin. The primary modification is the addition of support for folding code blocks in Python and other languages with indentation-based folding, while others include the porting from Delphi to Free Pascal along with various optimizations. EControl.ru's original lexer engine is closed source, but CudaText's version is open source, with the permission from EControl.ru.
366+
367+ * The **Lexer properties** dialog provides access to the configurable properties of the current lexer (selected via the status bar). Those properties are: lexer name, file types, commenting style, token colors, font styles (bold/italic/underline) and token borders.
368+ * The **Lexer library** dialog shows a list of the installed lexers, which reside in the folder `data/lexlib`. This dialog has the following hotkeys:
369+
370+**`Enter ⏎`**
371+
372+same as "Configure" button
373+
374+**`Del ⌦`**
375+
376+same as "Delete" button
377+
378+**`Esc`**
379+
380+closes the dialog
381+
382+[![](/wiki-images/a/a4/cudatext-zip-install-prompt.png)](</File:cudatext-zip-install-prompt.png>)
383+
384+[](</File:cudatext-zip-install-prompt.png> "Enlarge")
385+
386+Add-on ZIP file install dialog
387+
388+### Lexers on SourceForge
389+
390+CudaText installs with a limited set of lexers. All other lexers are available as [individual downloads hosted on cudatext.sf.net](<https://sourceforge.net/projects/cudatext/files/addons/lexers/>) or collectively as part of the [complete add-ons package](<https://sourceforge.net/projects/cudatext/files/addons_all/>), too.
391+
392+To install "lexer.*.zip" (or any add-on ZIP file) in CudaText: open this ZIP file via "File / Open", CudaText will suggest to install it.
393+
394+### List of lexers
395+
396+The following lexers (counting only important ones) exist for CudaText. They are available through the Addons Manager's **Install…** command.
397+
398+All these lexers, and preinstalled lexers, are published in the repository: <https://github.com/CudaText-addons/CudaText-lexers> . This link may be needed for people wanting to make 'Pull Requests' in Git.
399+
400+ * [1C:Enterprise script](<https://1c-dn.com/1c_enterprise/1c_programming_language/>)
401+ * [ABAP](<https://learning.sap-press.com/abap>)
402+ * [Abaqus Keywords](<https://www.3ds.com/products-services/simulia/products/abaqus/>)
403+ * [abc notation](<https://abcnotation.com/>)
404+ * [ActionScript](<https://help.adobe.com/en_US/as3/learn/index.html>)
405+ * [ACUCOBOL](<https://www.microfocus.com/en-us/products/acucobol-gt/overview>)
406+ * [Ada](<http://www.ada-auth.org/standards/rm12_w_tc1/html/RM-TTL.html>)
407+ * [Adept](<https://www.met.reading.ac.uk/clouds/adept>)
408+ * [Amazon Ion](<https://amazon-ion.github.io/ion-docs/>)
409+ * [AMPL](<https://ampl.com/>)
410+ * [AngelScript](<https://www.angelcode.com/angelscript/>)
411+ * [ANTLR](<https://www.antlr.org/>)
412+ * [APDL](<https://www.ansys.com/blog/what-is-apdl>)
413+ * [AppleScript](<https://developer.apple.com/library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/introduction/ASLR_intro.html>)
414+ * [Arduino](<https://www.arduino.cc/reference/en/>)
415+ * [AsciiDoc](<https://asciidoc.org/>)
416+ * [Assembly (ASM)](<http://www.wikipedia.org/wiki/Assembly_language> "wikipedia:Assembly language"):
417+ * [ARM Assembly (armasm)](<https://developer.arm.com/documentation/102438/0100/Learning-about-assembly-language>)
418+ * [STM32 ARM Assembly](<https://blog.st.com/stdevcon18-stm32-embedded-systems-assembly/>)
419+ * [AVR Assembly (AVRASM2)](<https://ww1.microchip.com/downloads/en/DeviceDoc/40001917A.pdf>)
420+ * [Dalvik bytecode (Smali)](<https://source.android.com/docs/core/runtime/dalvik-bytecode>)
421+ * [Flat Assembly (fasm)](<https://flatassembler.net/>)
422+ * [Game Boy/GB Color Assembly (RGBDS)](<https://rgbds.gbdev.io/>)
423+ * [GNU Assembly (as/gas)](<https://sourceware.org/binutils/docs-2.41/as.html>)
424+ * [JWasm Assembly](<https://www.japheth.de/JWasm/Manual.html>)
425+ * [Microsoft Macro Assembler x86/x64 (MASM)](<https://learn.microsoft.com/en-us/cpp/assembler/masm/microsoft-macro-assembler-reference?view=msvc-170>)
426+ * [MIPS Assembly](<https://web.cse.ohio-state.edu/~crawfis.3/cse675-02/Slides/MIPS%20Instruction%20Set.pdf>)
427+ * [Motorola 68000 Assembly](<http://68k.hax.com/>)
428+ * [Netwide Assembly x86 (NASM)](<https://www.nasm.us/>)
429+ * [PowerPC Assembly](<http://wikibooks.org/wiki/PowerPC_Assembly> "wikibooks:PowerPC Assembly")
430+ * [RISC-V Assembly](<http://www.wikipedia.org/wiki/RISC-V_assembly_language> "wikipedia:RISC-V assembly language")
431+ * [SHARC DSP Assembly](<https://www.analog.com/media/en/dsp-documentation/processor-manuals/236999443isr_21xxx.pdf>)
432+ * [SPARC Assembly](<http://wikibooks.org/wiki/SPARC_Assembly> "wikibooks:SPARC Assembly")
433+ * [Z80 Assembly (SjASM)](<https://xl2s.tk/sjasmmanual.html>)
434+ * [Astro](<https://astro.build/>)
435+ * [Asymptote](<http://www.wikipedia.org/wiki/Asymptote_\(vector_graphics_language\)> "wikipedia:Asymptote \(vector graphics language\)")
436+ * [AutoHotkey](<https://www.autohotkey.com/docs/v2/Language.htm>)
437+ * [AutoIt](<http://www.wikipedia.org/wiki/AutoIt> "wikipedia:AutoIt")
438+ * [Automake](<http://www.wikipedia.org/wiki/Automake> "wikipedia:Automake")
439+ * [Automation Basic (B&R Automation Studio)](<https://www.br-automation.com/en-us/products/software/additional-information/programming/#c56724>)
440+ * [AviSynth](<http://avisynth.nl/index.php/The_full_AviSynth_grammar>)
441+ * [AWK](<http://www.wikipedia.org/wiki/AWK> "wikipedia:AWK")
442+ * [Ballerina](<http://www.wikipedia.org/wiki/Ballerina_\(programming_language\)> "wikipedia:Ballerina \(programming language\)")
443+ * [Bash shell](<http://www.wikipedia.org/wiki/Bash_\(Unix_shell\)> "wikipedia:Bash \(Unix shell\)")
444+ * [Batch file](<http://www.wikipedia.org/wiki/Batch_file> "wikipedia:Batch file")
445+ * [Bazel configuration (bazelrc)](<https://bazel.build/run/bazelrc>)
446+ * [BibTeX](<http://www.wikipedia.org/wiki/BibTeX> "wikipedia:BibTeX")
447+ * [Bicep (Azure Resource Manager)](<https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/file>)
448+ * [Blueprint (GTK 4 UI compiler)](<https://gnome.pages.gitlab.gnome.org/blueprint-compiler/>)
449+ * [Bohemia Real Virtuality (SQF)](<https://community.bistudio.com/wiki/SQF_Syntax>)
450+ * [Boo](<http://www.wikipedia.org/wiki/Boo_\(programming_language\)> "wikipedia:Boo \(programming language\)")
451+ * [Brainfuck](<http://www.wikipedia.org/wiki/Brainfuck> "wikipedia:Brainfuck")
452+ * [C](<http://www.wikipedia.org/wiki/C_\(programming_language\)> "wikipedia:C \(programming language\)")
453+ * [C++](<http://www.wikipedia.org/wiki/C%2B%2B> "wikipedia:C++")
454+ * [C#](<http://www.wikipedia.org/wiki/C_Sharp_\(programming_language\)> "wikipedia:C Sharp \(programming language\)")
455+ * [C3](<https://c3-lang.org/>)
456+ * [Caffe (prototxt)](<https://caffe.berkeleyvision.org/>)
457+ * [Cangjie](<http://www.wikipedia.org/wiki/Cangjie_\(programming_language\)> "wikipedia:Cangjie \(programming language\)")
458+ * [Carbon](<http://www.wikipedia.org/wiki/Carbon_\(programming_language\)> "wikipedia:Carbon \(programming language\)")
459+ * [Clarion](<http://www.wikipedia.org/wiki/Clarion_\(programming_language\)> "wikipedia:Clarion \(programming language\)")
460+ * Clavier
461+ * [Clipper](<http://www.wikipedia.org/wiki/Clipper_\(programming_language\)> "wikipedia:Clipper \(programming language\)")
462+ * [Clojure](<http://www.wikipedia.org/wiki/Clojure> "wikipedia:Clojure")
463+ * [CMake](<http://www.wikipedia.org/wiki/CMake> "wikipedia:CMake")
464+ * [COBOL](<http://www.wikipedia.org/wiki/COBOL> "wikipedia:COBOL")
465+ * [CodeVisionAVR](<https://www.codevision.be/>)
466+ * [CoffeeScript](<http://www.wikipedia.org/wiki/CoffeeScript> "wikipedia:CoffeeScript")
467+ * [ColdFusion markup](<http://www.wikipedia.org/wiki/ColdFusion_Markup_Language> "wikipedia:ColdFusion Markup Language")
468+ * [Conditional Random Fields (CRF)](<http://www.wikipedia.org/wiki/Conditional_random_field> "wikipedia:Conditional random field")
469+ * [Crystal](<http://www.wikipedia.org/wiki/Crystal_\(programming_language\)> "wikipedia:Crystal \(programming language\)")
470+ * [CSS](<http://www.wikipedia.org/wiki/CSS> "wikipedia:CSS")
471+ * [CUDA C++](<https://docs.nvidia.com/cuda/cuda-programming-guide/02-basics/intro-to-cuda-cpp.html>)
472+ * [CUE](<https://cuelang.org/>)
473+ * [Cue sheet](<http://www.wikipedia.org/wiki/Cue_sheet_\(computing\)> "wikipedia:Cue sheet \(computing\)")
474+ * [Colecovision BASIC {CVBasic)](<https://nanochess.org/cvbasic.html>)
475+ * [D](<https://dlang.org/>)
476+ * [Dafny](<https://dafny.org/>)
477+ * [Dart](<https://dart.dev/>)
478+ * [Delphi resources](<https://www.delphibasics.info/home/delphibasicssnippets/usingresourcefileswithdelphi>)
479+ * [Dhall](<https://dhall-lang.org/>)
480+ * [Dictu](<https://dictu-lang.com/>)
481+ * [Diff / Patch files](<http://www.wikipedia.org/wiki/diff#Default_output_format> "wikipedia:diff")
482+ * [Dockerfile](<https://docs.docker.com/build/concepts/dockerfile/>)
483+ * [DOORS Extension Language (DXL)](<http://www.wikipedia.org/wiki/DOORS_Extension_Language> "wikipedia:DOORS Extension Language")
484+ * [Eiffel](<http://www.wikipedia.org/wiki/Eiffel_\(programming_language\)> "wikipedia:Eiffel \(programming language\)")
485+ * [Elixir](<https://elixir-lang.org/>)
486+ * [Elm](<https://elm-lang.org/>)
487+ * [.env files](<https://www.dotenv.org/docs>)
488+ * [Erlang](<https://www.erlang.org/>)
489+ * [Embedded Lua templates](<https://github.com/leafo/etlua>)
490+ * [Euphoria](<http://www.wikipedia.org/wiki/Euphoria_\(programming_language\)> "wikipedia:Euphoria \(programming language\)")
491+ * F#
492+ * Factor
493+ * Falcon
494+ * Fish
495+ * FIX Message (Financial Information eXchange)
496+ * foobar2000 title formatting (it's for Mp3tag too)
497+ * Forth
498+ * Fortran
499+ * FoxPro
500+ * FreeBASIC
501+ * Futhark
502+ * G-code (this is "lite" lexer)
503+ * GAMS
504+ * GDScript
505+ * [Gel Schema Definition Language (EdgeQL)](<https://docs.geldata.com/learn/schema>)
506+ * Gemini (web pages)
507+ * Gherkin (Cucumber; Behat)
508+ * GHS.com MULTI IDE (3 lexers)
509+ * Gleam
510+ * GLSL
511+ * GNU linker
512+ * Gnuplot
513+ * Go
514+ * Gold Parser
515+ * Grails Server Pages (GSP)
516+ * Graphviz DOT
517+ * GraphQL
518+ * Great Cow Basic
519+ * Groovy (Gradle)
520+ * Grub4Dos
521+ * Haml
522+ * Harbour
523+ * Hare
524+ * Haskell
525+ * Haxe
526+ * HCL (HashiCorp Configuration Language)
527+ * Heta
528+ * [HiveQL (Apache Hive)](<https://cwiki.apache.org/confluence/display/Hive/LanguageManual>)
529+ * HJSON
530+ * HLSL
531+ * HTML
532+ * HTML Diafan
533+ * HTML Django DTL
534+ * HTML Embedded JS
535+ * HTML Handlebars
536+ * HTML Laravel Blade
537+ * HTML Liquid
538+ * HTML Mustache
539+ * HTML Ruby-ERB
540+ * HTML Smarty
541+ * [httpd.conf (Apache HTTP Server)](<https://httpd.apache.org/docs/2.4/configuring.html>)
542+ * Huawei VRP
543+ * IDL files
544+ * IDL language
545+ * Informix 4GL
546+ * Ini files
547+ * Inno Setup
548+ * Intel HEX
549+ * Intel ISPC (Implicit SPMD Program Compiler)
550+ * Janet
551+ * Jasmine JVM Assembler
552+ * Java
553+ * Java Velocity
554+ * JavaScript
555+ * JavaScript Babel/React JSX
556+ * JCL
557+ * Jinja2
558+ * JQ
559+ * JSON
560+ * [Bitsquid Simplified JSON (SJSON)](<https://bitsquid.blogspot.com/2009/10/simplified-json-notation.html>)
561+ * Jsonnet
562+ * Julia
563+ * Just
564+ * [KDL](<https://kdl.dev/>)
565+ * Kivy
566+ * KiXtart
567+ * Koka
568+ * Kontakt Script Processor (KSP)
569+ * Kotlin
570+ * languageONE
571+ * LaTeX
572+ * Lean
573+ * LESS
574+ * Lisp
575+ * [Common Lisp](<http://www.wikipedia.org/wiki/Common_Lisp> "wikipedia:Common Lisp")
576+ * LiveCode script
577+ * Log files
578+ * Logstash DSL
579+ * Lola-2
580+ * LS-DYNA
581+ * Lua
582+ * [M4](<http://www.wikipedia.org/wiki/m4_\(computer_language\)> "wikipedia:m4 \(computer language\)")
583+ * Macro Scheduler script
584+ * Makefile
585+ * Markdown
586+ * MATLAB
587+ * Maya
588+ * MDX (Markdown with JSX)
589+ * MediaWiki
590+ * Meson
591+ * Metafont
592+ * MIB files
593+ * MikroTik Script
594+ * MiniZinc
595+ * Modelica
596+ * Modula-2
597+ * Modula-3
598+ * Mojo
599+ * Monkey
600+ * MoonBit
601+ * MS Visual Studio Solution
602+ * MusicBrainz Picard Tagger Script
603+ * MySQL
604+ * Nelua
605+ * Nemerle
606+ * Nginx
607+ * Nim
608+ * Nix
609+ * nnCron
610+ * NSIS
611+ * NSL Assembler
612+ * Oberon (and Component Pascal)
613+ * Objeck
614+ * Objective-C
615+ * OCaml
616+ * Odin
617+ * OpenCL
618+ * OpenEdge
619+ * OpenSCAD
620+ * Org-mode
621+ * P4 (Programming Protocol-independent Packet Processors)
622+ * Papyrus (for Skyrim game)
623+ * Parser3
624+ * Pascal
625+ * Pawn
626+ * PECmd script
627+ * Perforce Jam
628+ * Perl
629+ * PHP
630+ * PICL
631+ * [Pig Latin (Apache Pig)](<https://pig.apache.org/docs/r0.17.0/start.html#pl-statements>)
632+ * Pike
633+ * Pixilang
634+ * PKGBUILD
635+ * Pkl
636+ * PL/SQL
637+ * PlantUML
638+ * Pony
639+ * PostScript
640+ * Power Query M
641+ * PowerShell
642+ * Prolog
643+ * Properties
644+ * Protocol Buffers
645+ * Pug (previosly named "Jade")
646+ * Puppet
647+ * PureBasic
648+ * PureScript
649+ * PyMOL
650+ * Pyret
651+ * Python
652+ * [Cython](<https://cython.org/>)
653+ * QML (Qt Modeling Language)
654+ * R
655+ * R Markdown
656+ * Racket
657+ * Rainmeter
658+ * Ragel
659+ * Raku
660+ * Razor
661+ * ReasonML
662+ * Red
663+ * ReScript
664+ * reStructuredText
665+ * Rexx
666+ * Ring
667+ * Roc
668+ * [Rocq Prover](<http://www.wikipedia.org/wiki/Rocq> "wikipedia:Rocq")
669+ * RON
670+ * RPG/IV
671+ * RTF (Rich Text)
672+ * Ruby
673+ * Rust
674+ * Sass
675+ * Scala
676+ * Scheme
677+ * Scilab
678+ * SCSS
679+ * SFZ Format
680+ * Singularity
681+ * Slim
682+ * Smalltalk
683+ * Snowflake SQL
684+ * Solidity (Ethereum)
685+ * Specman
686+ * SPICE (PSpice, HSPICE)
687+ * SPIR
688+ * SQL (normal and "lite" lexers available)
689+ * Squirrel
690+ * SRT Subtitles
691+ * Standard ML
692+ * STAR (Self-defining Text Archive and Retrieval) (this is "lite" lexer)
693+ * Stata
694+ * Strace
695+ * Structured Text (IEC 61131-3)
696+ * Stylus
697+ * Svelte
698+ * Swift
699+ * SystemTap
700+ * T-SQL
701+ * TAGML
702+ * TakeCommand
703+ * Tcl/Tk
704+ * Textile
705+ * ToDo (for plugin "Plain Tasks")
706+ * Todo.txt (format from todotxt.org)
707+ * TOML
708+ * Tree
709+ * Twig
710+ * TypeScript
711+ * Typst
712+ * Umka
713+ * V
714+ * Vala
715+ * VBScript
716+ * Verilog HDL
717+ * VHDL
718+ * Vimscript
719+ * Virgil
720+ * Visual Basic
721+ * Visual dBase
722+ * VRML
723+ * Vue
724+ * WGSL
725+ * WikidPad (normal and "lite" lexers available)
726+ * WinBuilder script
727+ * Windows Resource Script
728+ * Wolfram
729+ * Wren
730+ * WSH script
731+ * XML
732+ * XSLT
733+ * Yacc (Bison)
734+ * YAML
735+ * ZenScript (MineTweaker)
736+ * Zephir
737+ * Zig
738+ * Ziggy
739+
740+### Lexers modification and creation
741+
742+[![SynWrite "Lexer properties" dialog](/wiki-images/e/ed/cudatext-lexer-editor-dlg.png)](</File:cudatext-lexer-editor-dlg.png>)
743+
744+[](</File:cudatext-lexer-editor-dlg.png> "Enlarge")
745+
746+Screenshot of SynWrite's "Lexer properties" dialog
747+
748+You can modify/create lexers. But not in CudaText. Install [SynWrite](<https://cudatext.github.io/synwrite/>) (Windows program, which can be run under Wine on Linux). There, you have lexer editor dialog.
749+
750+ * First, install your lexer to SynWrite. From the lexer's .zip package, copy files lexername.lcf and lexername.cuda-lexmap into SynWrite's "data\lexlib" folder.
751+ * In SynWrite, call "Lexer properties" dialog and edit all you need.
752+ * In SynWrite, install "ExLexer" addon. Then call "ExLexer" from the "Plugins" menu, choose needed lexer to export. You will have exported .zip file.
753+ * In CudaText open this .zip file, confirm installation of lexer.
754+
755+### Lexers editing - styles only
756+
757+For full-featured lexer editing, you must use SynWrite as described in the topic above. CudaText itself allows to edit only lexer styles, ie colors/ borders/ font-style (bold/italic/strikeout) of lexer styles. How to do that:
758+
759+ * Activate some lexer for the current document.
760+ * Call CudaText menu "Options / Lexers / Lexer properties", dialog "Lexer properties" will open.
761+ * In the "Lexer properties" dialog, activate "Styles" tab, it has UI to customize styles in the active lexer. This UI is enabled only when lexer themes are Off, ie option `"ui_lexer_themes":false`.
762+
763+By default that option is On so UI is disabled. If you enable the UI, you can customize all lexer styles. Configuration will be saved to the files "settings/*.cuda-lexops". These files are auto-loaded by CudaText on start.
764+
765+### How to setup styles of hidden sublexer
766+
767+Some lexers are distributed in packages together with sub-lexer, and sub-lexer is hidden. Example: "HTML Django" with sub-lexer "HTML Django internal" (the second one isn't visible in the Lexers menu, so it's called hidden). Users, which have option "ui_lexer_themes" off, want to configure styles of all lexers. How to access hidden ones?
768+
769+ * Open "Lexer library" dialog (menu: Options / Lexer / Lexer library).
770+ * In dialog, focus needed lexer, press "Configure" button
771+ * Dialog "Lexer properties" will open for selected lexer
772+ * In dialog's "Styles" tab, configure all you need
773+
774+You can change visibility of lexer in SynWrite lexer editor (the checkbox will write line "Internal = True" at the end of .lcf file).
775+
776+### How to create distributive of new lexer
777+
778+In SynWrite, you've created .lcf file in folder SynWrite/Data/LexLib. If you configured "Commenting" options, also file .cuda-lexmap is created. Now you need to create .zip installation of lexer, for both editors: SynWrite, CudaText.
779+
780+ * In lexer file, replace system colors to usual colors: replace "clWindowText" to "clBlack" (clWindowText may be light on CudaText on Linux); replace "clInfoText" and "clInfoBk" too.
781+ * In SynWrite, in Addon Manager, install plugin "ExLexer".
782+ * In SynWrite, run menu item "Plugins / ExLexer", to create .zip for your lexer.
783+ * In CudaText, open this new zip file, this installs lexer to CudaText.
784+ * In CudaText, activate your lexer, dialog should show: "Lexer style mapping". Fill items in this dialog.
785+ * In CudaText, test this "lexer style map" in action: open file with your lexer active, and activate "default" UI theme, then activate "sub" UI theme. Main themes must show nice colors in your syntax file. Call dialog "Options / Lexers / Lexer style mapping" to fix colors.
786+ * In prev step, you configured .cuda-lexmap file, in folder CudaText/data/lexlib. Copy this file to zip installation of your lexer.
787+ * Zip must contain: install.inf, .lcf file(s), .cuda-lexmap file per each lexer.
788+
789+You can place file(s) "lexer LexerName.json" into zip archive, per each lexer in zip archive. These JSON files will be installed to the folder "settings_default" of CudaText. Ie, these are lexer-specific configs for lexers. Some lexers do this already: Lua, Pascal, PHP, Ruby, TypeScript.
790+
791+### Lite lexers
792+
793+Lite lexers are lexers is special format (internally it's JSON file), with very limited features. They don't support code-tree, folding, don't support multi-line comments, don't have rich highlighting (e.g. background highlight of string `12+$var` with additional highlight for 12 and $var inside). And they don't keep tokens information in memory (positions of found tokens in text). Lite lexers process only lines visible on screen, not all document lines. So, they work fast for any file size.
794+
795+Limitation: on lines longer than 4K chars, only first 4K chars have the syntax highlighting.
796+
797+Lite lexers have the " ^" suffix in name. You can activate lite lexers from the usual lexers menu. Several lite lexers are preinstalled:
798+
799+ * Ini files ^
800+ * JSON ^
801+ * Log files ^
802+ * SQL ^
803+ * XML ^
804+
805+Lite lexers are automatically activated for big files, when file size is bigger than option "ui_max_size_lexer". For example, for small sized JSON files normal "JSON" lexer is activated, but for huge JSON files - lite lexer "JSON ^" is automatically activated. Lite lexers are activated for small files, if normal lexer for file-extension is not found. For example, "SQL ^" is used for small SQL files, because "normal" SQL lexer is not preinstalled.
806+
807+How to change styles in lite lexers? For example, "Log files ^" uses styles "Id"/"Id2", and you want to change that? It's easy:
808+
809+ * open the file: [CudaText]/data/lexliblite/Log files.cuda-litelexer
810+ * find and edit styles names
811+ * all possible styles are listed in the CudaText dialog "Options / Themes / Settings - theme - syntax..."
812+
813+Here is short description of file fields, on the example file "data/lexliblite/Ini files.cuda-litelexer":
814+```
815+{
816+ "about": "INI lexer by Alexey Torgashin",
817+ "files": "*.ini;*.dsk;*.dti;*.dof;*.inf;*.lng;*.srv;*.reg;*.sas;*.cfg;*.desktop",
818+ "cmt_line": ";",
819+ "case_sens": true,
820+ "consider_spaces": true,
821+ "rules": {
822+ "cmt": {
823+ "regex": "^\\s*[;\\#].*",
824+ "style": "Comment"
825+ },
826+ ...
827+ "val": {
828+ "regex": "\\w+",
829+ "style": "Id"
830+ }
831+ }
832+ }
833+```
834+
835+ * "about": Info about file's author.
836+ * "files": One or several file masks, separated by ";".
837+ * "cmd_line": Single-line comment chars. Used by "Comments" plugin when you call commands of this plugin.
838+ * "case_sens": Boolean flag for case-sensitivity for RegEx-rules listed below in that file.
839+ * "consider_spaces": Boolean flag which enables to parse spaces/tabs between words by RegEx-rules. Otherwise, parser will skip spaces/tabs silently.
840+ * "rules": Dictionary with parser rules, which must have one or more dictionaries with any names but fixed contents:
841+ * "regex": RegEx (ie regular expression) of the rule.
842+ * "style": Style name, to color that rule results. Possible values are listed in the CudaText dialog "Options / Themes / Settings - theme - syntax..."
843+
844+### Differences in lexer support in CudaText/SynWrite
845+
846+ * SynWrite supports "lexer grammar", while CudaText does not support "grammar" anymore.
847+ * SynWrite lexers need constructs like \x0D\x0A or \z (to catch any line-break: LF, CRLF, CR), while CudaText lexers are OK with simple \n (because internal buffer always has LF separator).
848+ * Some lexers need to find equal identifiers at begin/end of blocks: HTML, Bash, others. Bash lexer needs extended feature: to see NAME and 'NAME' and "NAME" as equal identifiers (word and quoted word). Only CudaText has this extended feature, not SynWrite.
849+ * For CudaText you must avoid "system colors" in lexer styles (e.g. "window background", "window text", "hint background"), because OS'es have different system colors.
850+ * SynWrite lexer settings are not used in CudaText:
851+ * Option "Restart analysis from the line start" has no effect, it is forced to On in CudaText
852+ * Default style
853+ * Selection mark style
854+ * Search mark style
855+ * Current line style
856+ * Collapse mark style
857+ * Character set
858+ * Multiline border
859+ * Options in groups "Syntax tree decoration", "Pen"
860+
861+### How to make editor re-scan entire document on editing
862+
863+The question makes sense, because when user types the block ending (e.g. "}" in C syntax), editor re-scans the document from the last changed line, and cannot detect that new block is just appeared.
864+
865+Find the lexer file, .lcf file in the folder data/lexlib. This file has the ending with "end", before "end" you see several lexer settings. You can add there:
866+```
867+FullRefreshSize = 5000
868+```
869+
870+Insert it near the end of file, like here:
871+```
872+FullRefreshSize = 5000
873+ Charset = DEFAULT_CHARSET
874+ end
875+```
876+
877+This tells lexer to re-scan entire document, on editing in any document place, when document size is less than 5000 chars.
878+
879+### How to support Spell Checker in lexer
880+
881+Plugin "Spell Checker" checks text, which is inside "strings" and "comments". So you must configure lexer and set there, which lexer elements (tokens) are "strings" and "comments". It is options in the "Lexer properties" dialog of SynWrite, in the "Commenting" tab of dialog. You can change these options without SynWrite too - they are in the "data/lexlib/LexerName.cuda-lexmap" file, both options are comma-separated names of lexer styles.
882+
883+For example, let's see XML lexer. Spell Checker must handle these styles:
884+
885+ * style applied to XML/HTML comments
886+ * style applied to quoted strings in XML tags
887+ * style applied to usual text out of angle brackets
888+
889+If you see lexer config in SynWrite, you will find that we need styles "Comment", "Text" and "Tag val". So we specify in the file "data/lexlib/XML.cuda-lexmap":
890+```
891+[comments]
892+ styles_cmt=Comment
893+ styles_str=Text,Tag val
894+```
895+
896+## Fenced code-blocks
897+
898+[![](/wiki-images/5/59/cudatext-fenced-blocks.png)](</File:cudatext-fenced-blocks.png>) [](</File:cudatext-fenced-blocks.png> "Enlarge")Fenced code blocks
899+---
900+
901+This is the feature of Markdown syntax: fenced code blocks. Blocks begin with:
902+
903+ * start of line
904+ * optional spaces
905+ * 3 or more backtick-chars (also tilde-chars are allowed)
906+ * optional spaces
907+ * lexer alias like "cpp" or "cs"
908+ * optional spaces
909+ * end of line.
910+
911+Blocks end with:
912+
913+ * start of line
914+ * optional spaces
915+ * 3 or more backtick-chars (also tilde-chars are allowed)
916+ * optional spaces
917+ * end of line.
918+
919+The beginning and ending sequences are tokenized as single token.
920+
921+CudaText has the file which lists the supported lexer aliases: data/lexlib/aliases.ini. The file was compiled from [this document](<https://github.com/highlightjs/highlight.js/blob/main/SUPPORTED_LANGUAGES.md>). Lexer alias will be resolved to the actual lexer name, only if that lexer is installed, otherwise you won't see an error, but block will not be syntax-highlighted.
922+
923+**Limitations:**
924+
925+ * Markdown standard tells that the beginning backticks must match the ending backticks, it must be the same amount of backticks. (And the same is valid for tildes.) This is currently not supported in CudaText.
926+ * Python Markdown description tells that the lexer alias may be replaced with the curly-brackets construct like "{ .lang }" or "{ .lang .foo .bar }" or even "{ #someid .lang .foo .bar }". This is currently not supported in CudaText.
927+ * The similar feature of the reStructuredText, as [documented here](<https://pandemic-overview.readthedocs.io/en/latest/myGuides/reStructuredText-Source-Code.html>), is not supported.
928+
929+**Note about SQL blocks.**
930+
931+CudaText has lexer preinstalled, it's lite lexer "SQL ^", and it cannot be used here, because lite lexer cannot be called from normal lexer. But you can install (from "Plugins / Addons Manager") normal lexers: SQL; T-SQL (T-SQL has it's own alias "tsql"). Just install one of them, and it will be used for SQL blocks.
932+
933+**Note about Typst lexer.**
934+
935+This lexer also supports fenced code blocks but it has its own independent rules of sub-lexers. It means Typst lexer does not rely on CudaText special code to search for sub-lexers. It has own rules. For example, for sub-lexer 'Bash script', Typst has such RegEx to search for block beginning:
936+```
937+`{3,}(shell-script|sh|bash|zsh)\b
938+```
939+
940+and such RegEx to search for block ending:
941+```
942+`{3,}(?!\w)
943+```
944+
945+## Dynamic highlight
946+
947+[![](/wiki-images/f/f8/cudatext-dynamic-hi.png)](</File:cudatext-dynamic-hi.png>) [](</File:cudatext-dynamic-hi.png> "Enlarge")Dynamic highlighting for HTML/XML/Lua
948+---
949+
950+Dynamic highlight is controlled by option "dynamic_highlight". Option allows the caret-dependant highlighting only in documents which have not more than N (option value) lines. This limitation is useful because dynamic highlight makes lexer parsing slower.
951+
952+Feature enables to highlight some 'tokens' dynamically (with default greenish background color), when caret changes position. It works only when lexer is configured to use this feature. These lexers in the CudaText distro use it:
953+
954+ * HTML, PHP, XML: opening tag and corresponding closing tag are highlighted, when caret is over one of them
955+ * CSS: rule highlights {} block with different background color, when caret is inside that block
956+ * Bash: block edge tokens are highlighted when caret is inside the block: 'if'/'fi', 'case'/'esac', 'do'/'done'
957+ * Lua: block edge tokens are highlighted when caret is inside the block: 'function'/'end', 'if'/'end', 'do'/'end'
958+
959+**Examples:**
960+
961+ * On the HTML example editor, 2 fragments have dynamic highlighting (because of 2 multi-carets). First caret is placed inside tag 'h1' but before tag 'a'. Second caret is placed inside tag 'a'. So second caret enables dynamic highlight of angle brackets too, not only of a tag.
962+ * On the XML example editor, lexer highligts 'data' tag, surrounding the caret.
963+ * On the Lua example editor, lexer highlights 2 nested blocks, surrounding the caret: function/end and do/end.
964+
965+In the old times, dynamic highlight was also utilized in Pascal lexer to highlight tokens 'begin'/'end' when caret is inside the block. Later Pascal lexer was simplified and setting was removed. Few other lexers from Addons Manager also utilize this feature.
966+
967+It is possible to detect if some lexer utilizes this feature. Look inside LexerName.lcf file, find there "DynHighlight" parameter. Two typical configurations allow dynamic highlight:
968+
969+HTML, PHP, Lua:
970+```
971+DynHighlight = dhBound
972+ HighlightPos = cpRange
973+```
974+
975+CSS:
976+```
977+DynHighlight = dhRange
978+ HighlightPos = cpRange
979+```
980+
981+## Folding
982+
983+[![](/wiki-images/4/4b/cudatext-folding-gutter-ctx-menu.png)](</File:cudatext-folding-gutter-ctx-menu.png>) [](</File:cudatext-folding-gutter-ctx-menu.png> "Enlarge")Code folding context menu, accessed from the gutter
984+---
985+
986+"Folding" is the feature allowing to collapse (ie fold) multi-line blocks of code. Collapsed block usually shows the rectangle-like mark on the first line, and other block lines become fully hidden. Collapsed block can start from any column, but it consumes entire next lines. App shows special column in the "gutter" (vertical band with line numbers), with plus/minus icons - click on these icons collapses/uncollapses the corresponding block. Folding rules, about what blocks can be folded, are configured in the lexer file.
987+
988+There are several options to customize related functionality: to find them all, call menu item "Plugins / Options Editor Lite" and enter the dialog filter string "fold".
989+
990+Folded blocks can be shown in few different ways, see the option "fold_style":
991+
992+ * rectangle-mark at the beginning of the range (maybe after some text in the line)
993+ * rectangle-mark after the end of the first line of the range
994+ * "− − −" dashed line below the first line of the range
995+
996+Clicks on the first partially folded line:
997+
998+ * Click on the rectangle-mark does not unfold the block, because double-click must be handled. Double-click on the rectangle-mark selects the entire block (even if it's folded and user cannot see the selection).
999+ * When option "fold_style" has value 0 to 2, clicking of the first partially folded line (out of rectangle-mark) unfolds the block. When "fold_style" has another value, click does not unfold the block, and user can mouse-select some part of the line.
1000+
1001+To select an entire folded block by keyboard, place the caret right before the beginning of the block, and press Shift+Down. Ie, make selection to the beginning of the next _unfolded_ line.
1002+
1003+### Gutter folding right-click menu
1004+
1005+Gutter's folding band supports right-click menu. It gives commands to fold/unfold all blocks which touch the right-clicked editor line. When it can be useful? For example, you have JSON file with line:
1006+```
1007+"data": [{
1008+```
1009+
1010+Here you have outer block (square brackets) with inner block (curly brackets). Click on folding icon will fold the outer block. What if you want to fold the inner block? Right-click on gutter's folding band, and you will see the popup menu with menu items:
1011+```
1012+Line 6: "data": [{
1013+ Line 6: "data": [{
1014+```
1015+
1016+Clicking the first item will fold/unfold the outer block, clicking the second item will fold/unfold the inner block.
1017+
1018+### Excluding of last line from folding
1019+
1020+Lexer JSON has special behaviour of folding, for such situations:
1021+```
1022+[
1023+ {
1024+ 1: 2
1025+ }, {
1026+ 3: 4
1027+ }, {
1028+ 5: 6
1029+ }
1030+ ]
1031+```
1032+
1033+Try to fold first 2 blocks in this example. You see that last line of block is excluded from folding, it is a feature.
1034+
1035+Auto-excluding of last line works automatically. But for rare cases, it is needed to disable it. For example, Rainmeter lexer: its folding rules fits the criteria of last line excluding, but it is bad for the user. So last line excluding must be disabled manually for Rainmeter lexer. Setting exists in the file "data/lexlib/*.cuda-lexmap":
1036+```
1037+[op]
1038+ fold_exclude_line=0
1039+```
1040+
1041+### Automatic folding of comments
1042+
1043+[![](/wiki-images/3/3e/cudatext-fold-comments.png)](</File:cudatext-fold-comments.png>) [](</File:cudatext-fold-comments.png> "Enlarge")Auto-folding of comments
1044+---
1045+
1046+There is an option "auto_fold_comments" (default is 0 - it's turned off) which allows to automatically create folding ranges from N (or more) consecutive lines, which are all "syntax comments" and/or "syntax strings". This works for both line-comments and stream-comments, they can be even mixed (one comment after another without blank lines in between, but not for several stream-comments on a single line). This works for multi-line string literals and for single-line string literals (single-line literals can go one after another without symbols in between, which is rarely supported by languages, but it occurs sometimes).
1047+
1048+Which lexer literals are "comment"/"string"? This is setting of lexer, it is stored in the data/lexlib/*.cuda-lexmap file like this:
1049+```
1050+[comments]
1051+ styles_cmt=Comment,Comment doc
1052+ styles_str=Text,Tag string
1053+```
1054+
1055+There is also per-lexer setting to disable auto-folding for lexer, in the file "data/lexlib/*.cuda-lexmap":
1056+```
1057+[op]
1058+ auto_fold=0
1059+```
1060+
1061+This setting is present for lexers:
1062+
1063+ * Markdown
1064+ * reStructuredText
1065+ * MediaWiki
1066+ * WikidPad
1067+ * Textile
1068+
1069+ie for all lexers which support built-in Pascal tree-helpers. Because Pascal tree-helpers make folding ranges which conflict with auto-folding ranges.
1070+
1071+## Encodings
1072+
1073+You can change encoding of document by clicking on statusbar item, or by using menu "File / Encoding". Menu will give list of encodings. Menu gives 2 sub-menus:
1074+
1075+ * "Reload as": Reload file in given encoding from disk.
1076+ * "Convert to": Change encoding in memory only (this doesn't save the file).
1077+
1078+Possible encoding names for command-line usage:
1079+
1080+ * utf8
1081+ * utf8_bom
1082+ * utf16le
1083+ * utf16le_bom
1084+ * utf16be
1085+ * utf16be_bom
1086+ * utf32le
1087+ * utf32le_bom
1088+ * utf32be
1089+ * utf32be_bom
1090+ * cp1250
1091+ * cp1251
1092+ * cp1252
1093+ * cp1253
1094+ * cp1254
1095+ * cp1255
1096+ * cp1256
1097+ * cp1257
1098+ * cp1258
1099+
1100+ * cp437
1101+ * cp850
1102+ * cp852
1103+ * cp861
1104+ * cp865
1105+ * cp866
1106+ * cp874
1107+ * shift-jis
1108+ * gbk
1109+ * cns
1110+ * uhc
1111+ * big5
1112+ * gb2312
1113+ * euc-kr
1114+
1115+ * iso-8859-1
1116+ * iso-8859-2
1117+ * iso-8859-3
1118+ * iso-8859-4
1119+ * iso-8859-5
1120+ * iso-8859-7
1121+ * iso-8859-9
1122+ * iso-8859-10
1123+ * iso-8859-13
1124+ * iso-8859-14
1125+ * iso-8859-15
1126+ * iso-8859-16
1127+ * mac
1128+ * koi8r
1129+ * koi8u
1130+ * koi8ru
1131+
1132+## Line ends
1133+
1134+All major types of line-ends are supported:
1135+
1136+ * CR LF (usual for Windows)
1137+ * LF (usual for Linux and Unix)
1138+ * CR (usual for Mac OS 9, now almost not used)
1139+
1140+Mixed line-ends (LF with CR with CR LF) in one document are supported. Because of this feature, CudaText saves binary files to disk without corrupting them. To see mixed line-ends, use application option "unprinted_content", which can show text marks ("lf" etc) at line-ends.
1141+
1142+Commands:
1143+
1144+ * To change line-ends for all lines in the current document, click statusbar cell for line-ends, menu will appear. You need to save file then. Changed line-ends can be undone via "Undo". Also 3 commands are available in the Command Palette.
1145+ * To change line-ends for individial lines, use 3 commands in the Command Palette: "change line ends, for line(s) with caret: CR LF / LF / CR".
1146+
1147+# Additional indentation on Enter
1148+
1149+Some languages need that after pressing Enter, you make the additional indentation on the next line. For example, Python: it needs additional indentation after "def name():" and in some other cases. CudaText solves this via option "indent_auto_rule". Option must contain the regular expression which will be tested against the line on which you press Enter. CudaText ships predefined setting "indent_auto_rule" for several lexers: look at files "settings_default/lexer *.json".
1150+
1151+Example for Nim lexer. It needs indentation when you press Enter on a line ending with "=" or ":". And on a line with keywords "let", "var", "import". So write to the lexer-specific config "settings/lexer Nim.json":
1152+```
1153+{
1154+ "indent_auto_rule": "^\\s*(let|var|import)$|.+[=:]$",
1155+ }
1156+```
1157+
1158+Note for C-like lexers. Pressing Enter when caret is inside {} brackets (just after the brackets auto-pairing) - this is handled by CudaText specially, no option is needed here.
1159+
1160+# Groups of tabs
1161+
1162+"Groups" are sets of ui-tabs, where each ui-tab has attached editor control. By default only the first group is shown. Totally 6 "fixed" groups (located in the main app window) + 3 "floating" groups can be shown. Menu item "Split" allows to choose grouping mode:
1163+
1164+ * One group
1165+ * 2 groups: vertically or horizontally
1166+ * 3 groups: vertically, horizontally or 1+2
1167+ * 4 groups: vertically, horizontally or grid
1168+ * 6 groups: vertically, horizontally or grid
1169+
1170+First group cannot be empty, at least one tab exists in it. Other groups can be empty: on closing last tab, if it's active, the first group activates.
1171+
1172+ * You can drag-drop tabs from any group to any other visible group (drop only on tabs area).
1173+ * You can move tabs to other groups (by group number or to the next/previous), using commands in tab headers context menu.
1174+ * In grouping modes "2 groups" and "1+2" there's a context menu for splitter, to choose splitting 50/50, 40/60 etc.
1175+ * On changing grouping mode, tabs from disappearing group(s) are moved to still visible group.
1176+
1177+3 "floating" groups are available, besides 6 "fixed" groups, they are inside separate windows (so can be moved to separate monitor). To move some ui-tab to floating group, call context menu over ui-tab title, choose menu item "Move tab to group / Floating n" (n = 1, 2, 3).
1178+
1179+If a "floating" group is focused, you should not click main window's menu items to perform commands. Instead, call commands by hotkeys. By clicking on the main window (for example: on the code-tree, when code-tree is in the main window), you move the focus to the "fixed" group and editor command will execute for the "fixed" group.
1180+
1181+# Auto-completion
1182+
1183+Command "auto-completion menu" (default hotkey: Ctrl+Space) shows auto-completion listbox.
1184+
1185+Command "go to definition" (default activation: see #Mouse_shortcuts), jumps to the declaration of the identifier under first caret.
1186+
1187+"Go to definition" and "auto-completion menu" require installed plugin (for example, "LSP Client" with configuration file "settings/lsp_xxxx.json"). If you did not install plugin yet - "go to defintion" does nothing, showing the error "No goto-definition plugin installed for this lexer" in the bottom statusbar.
1188+
1189+## IntelliSense
1190+
1191+Intelligent completion is supported via plugins. For the 2021 year, such plugins exist:
1192+
1193+ * [[CudaText plugins|LSP Client]] \- supports Microsoft LSP protocol, for lot of languages. Plugin was tested to work good with servers: Python, C++, C#, CSS/SCSS/LESS, JavaScript/TypeScript, Go, Rust.
1194+
1195+And specialized plugins:
1196+
1197+ * for Python lexer - "Python IntelliSense"
1198+ * for HTML lexer - "HTML Completion", gives additional completion for "id" and "class" names
1199+ * for AutoIt lexer - "AutoIt Helper"
1200+ * for SPIR lexer - "SPIR Helper"
1201+
1202+In the case of files without lexer, consider to use plugins "Complete From Text" and "Intext Complete". They suggest completions from all words from the current document (or all opened documents, by option).
1203+
1204+## Static auto-completion files
1205+
1206+Some lexers (e.g. PHP, Pascal, Clojure) provide .acp files, which are fixed set of special words, to show in completion listbox. This is very simple completion, which ignores current context, it only suggests matching strings for the word (or string) under caret. These .acp files are stored in the folder "data/autocomplete".
1207+
1208+## Special HTML auto-completion
1209+
1210+Lexer HTML (and lexers with "HTML" in name, see the option "autocomplete_html_lexers") has its special logic, which is built-in in CudaText. It uses data files in the folder "data/autocompletespec" plus built-in code.
1211+
1212+Note: what is "tag", "attribute", "value" below? HTML lines has the form like:
1213+```
1214+<tag attribute1="value1" attribute2="value2" ...> some text </tag>
1215+```
1216+
1217+Completion listbox shows different information depending on context:
1218+
1219+ * Caret is on empty space or after "<". Listbox shows list of tags.
1220+ * Caret is on tag name (opening or closing). Listbox shows list of tags (beginning with typed tag).
1221+ * Caret is after opening tag, before closing bracket, on empty space. Listbox shows list of tag's attributes.
1222+ * Caret is on tag's attribute, before "=". Listbox shows list of attributes (beginning with typed attribute).
1223+ * Caret is after tag's attribute, after "=". Listbox shows list of possible values of attribute, for fixed set of values.
1224+ * Caret is inside attribute's quoted value. Possible cases:
1225+ * Some tag/attribute with fixed set of values. Listbox shows list of possible values (beginning with typed value).
1226+ * Tag A, attribute HREF. Listbox shows list of folders and all files (all files can be hyper-linked).
1227+ * Tag LINK, attribute HREF. Listbox shows list of folders and CSS files.
1228+ * Tag SCRIPT, attribute SRC. Listbox shows list of folders and JS files.
1229+ * Tag IMG/INPUT, attribute SRC. Listbox shows list of folders and picture files.
1230+ * Tag FRAME/IFRAME, attribute SRC. Listbox shows list of folders and HTML/PHP/ASP files.
1231+ * Tag AUDIO, attribute SRC. Listbox shows list of folders and audio files (HTML supports few extensions).
1232+ * Tag VIDEO, attribute SRC. Listbox shows list of folders and video files (HTML supports few extensions).
1233+ * Tag SOURCE, attribute SRC. Listbox shows list of folders and audio+video files (code doesn't detect the outer tag: audio, video etc).
1234+ * Caret is after '&' char with optional word-chars after '&'. Listbox shows HTML entities.
1235+
1236+[![cudatext-complete-pics.png](/wiki-images/e/e1/cudatext-complete-pics.png)](</File:cudatext-complete-pics.png>)
1237+
1238+About folders/filenames completion. Listbox items list depends on part of the quoted value before the caret. Folder/file names are taken from the folder/subfolder/up-folder of the current editor's document. Some examples, where caret is shown as "|".
1239+
1240+ * Value "|end": All filenames.
1241+ * Value "ab|end": Filenames beginning with "ab".
1242+ * Value "bar/foo/|end": All filenames, from subfolder "bar/foo".
1243+ * Value "../foo/bar/ab|end": Filenames beginning with "ab", from relative folder "../foo/bar".
1244+
1245+[![cudatext-complete-filenames.png](/wiki-images/9/9a/cudatext-complete-filenames.png)](</File:cudatext-complete-filenames.png>)
1246+
1247+To use auto-completion of CLASS= and ID= names (ie suggest mentioned names for partially typed names), you need the plugin "HTML Completion".
1248+
1249+## Special CSS auto-completion
1250+
1251+Lexer CSS (see the option "autocomplete_css_lexers") has its special logic, which is built-in CudaText. It uses data files in the folder "data/autocompletespec". Several possible cases are handled:
1252+
1253+1) Caret is inside {} brackets:
1254+
1255+ * Caret is on CSS property name. Listbox shows list of properties (beginning with the typed value).
1256+ * Caret is after CSS property and ":". If that CSS property has fixed set of values, listbox shows list of those values (beginning with the typed value).
1257+ * Special case is "custom CSS properties", which start with double dashes, like "--my-var1". App supports completion of these names, when caret in inside "var()" function. App searches for all custom properties names mentioned in the current document.
1258+
1259+2) Caret is outside of {} brackets:
1260+
1261+ * Caret is after tag name with char "@". Listbox shows list of CSS at-rules.
1262+ * Caret is after tag name with char ":". Listbox shows list of CSS pseudo-elements, beginning with ":" and "::".
1263+
1264+3) Caret is in URL specifier (which is used to specify relative filename of a picture):
1265+```
1266+url(path|)
1267+ url("path|")
1268+ url('path|')
1269+```
1270+
1271+Listbox shows folder/file names, if "path" lefter than the caret contains valid partial path. Slashes must be forward ones. For example, url("./|") shows folders/files from the document's folder. For example, url("subdir/|") shows files/folders from the subfolder "subdir".
1272+
1273+## File URI auto-completion
1274+
1275+File URI is file path in the form like 'file://localhost/dir/filename' or 'file:///dir/filename' (host name 'localhost' is often missed). On Windows URI can look like 'file:///c:/dir/filename'.
1276+
1277+CudaText supports auto-completion for file URIs, when caret is on 'dir/filename' part, and file path exists on local user's PC.
1278+
1279+[![cudatext-complete-fileuri.png](/wiki-images/1/1a/cudatext-complete-fileuri.png)](</File:cudatext-complete-fileuri.png>)
1280+
1281+Auto-completion behaviour for this case is described in the topic about HTML completion, see "folders/filenames completion".
1282+
1283+# Code-Tree
1284+
1285+Code-tree is treeview UI control which shows list of document's 'symbols': classes/functions/structs/etc, from the lexer (only if lexer supports this). To show code-tree, activate the side-panel (default hotkey: F12). Many lexers support code-tree: most C-based, HTML, XML, CSS, JS etc. Example of tree for Pascal:
1286+
1287+[![atsynedit tree.png](/wiki-images/f/f8/atsynedit_tree.png)](</File:atsynedit_tree.png>)
1288+
1289+ * Double-click on a tree node moves caret to its text.
1290+ * Tree is filled after few seconds after file opening (search for options ui_tree* to change this pause).
1291+ * When you move caret, tree shows tree node for caret position, after a pause (search for options ui_tree* to change this).
1292+
1293+Code-tree has the "filter" input field: when not empty, code-tree shows only items containing the filter text. This field also supports filtering by few **space-separated words**. There is also **Shift+Enter hotkey** in the filter field: it adds current filter string to the drop-down combobox history. Last entered filter strings are saved/restored to/from sessions.
1294+
1295+Code-tree has the context menu with items:
1296+
1297+ * "Fold all"
1298+ * "Unfold all"
1299+ * "Fold level", 2 to 9
1300+ * "Sorted": to toggle the alphabetical sorted mode of the tree
1301+
1302+Code-tree for CSS lexer has additional feature: in the "Colors" node, it shows colored preview-squares for HTML color-tokens - #AABBCC / #ABC / rgb(...) / rgba(...) / hsl(...) / hsla(...).
1303+
1304+[![cudatext-tree-css-colors.png](/wiki-images/d/d4/cudatext-tree-css-colors.png)](</File:cudatext-tree-css-colors.png>)
1305+
1306+# Console panel
1307+
1308+Panel is called by key Ctrl+tilde (Ctrl+`). It has read-only memo with output and edit field. You can type Python commands in the edit field, they will run and show output in the memo. E.g. enter "print(10+12)" and you'll see output "22". Can enter complex commands: e.g. "for i in range(10): print(i)".
1309+
1310+[![cudatext-console.png](/wiki-images/b/b2/cudatext-console.png)](</File:cudatext-console.png>)
1311+
1312+ * If you enter command beginning with "=", then it's the same as you enterted "print()". E.g. command "=10+12" will give "22".
1313+ * If you end command with ";", it won't be added to dropdown history.
1314+ * Double-click on memo lines:
1315+ * If line starts with ">>>", it repeats the old command (after ">>>" symbols).
1316+ * For other lines, it runs "Navigate" context-menu command.
1317+
1318+You can enter commands from CudaText API. Example clears all bookmarks and sets bookmark on line 11 (these are several commands, run one by one):
1319+```
1320+from cudatext import *
1321+ ed.bookmark(BOOKMARK_CLEAR_ALL, 0)
1322+ ed.bookmark(BOOKMARK_SET, 10)
1323+```
1324+
1325+## How to use Console as calculator
1326+
1327+Call Console panel with Ctrl+` (Ctrl+tilde). In its input field, enter valid Python expressions with leading "=" char. To use "sin", "cos", "pi" etc, first enter command "from math import *".
1328+
1329+Example of 3 entered lines and their log in console:
1330+```
1331+>>> from math import *
1332+ >>> =pi
1333+ 3.141592653589793
1334+ >>> =100/5+2
1335+ 22.0
1336+```
1337+
1338+# Command Palette
1339+
1340+Command Palette is a dialog which shows all embedded and external (plugin) commands in a single list. To call it, use hotkey Ctrl+Shift+P (or alias hotkey F1). To configure hotkey for some command in Palette, focus this command in listbox and press F9 - additional dialog will appear. CudaText remembers last chosen listbox item in the history file.
1341+
1342+Command Palette (and menu-like dialog in Python API) has the filter field. Filter supports fuzzy search, if the option "ui_listbox_fuzzy" is on. "Fuzzy" means that filter leaves only those listbox items, which contain all filter chars in ascending order. Example of fuzzy matches:
1343+
1344+ * "fop" matches "file: open file"
1345+ * "gttb" matches "goto text begin"
1346+
1347+If option is off, filter uses normal search. "Normal" means that filter leaves only those listbox items, which contain all words from the filter (in any order).
1348+
1349+Filter field can find hotkeys too. Enter only hotkey substring, with first "@" char. E.g. "@ho" finds "Ctrl+Home". This search is not fuzzy.
1350+
1351+Command Palette lists all internal CudaText commands, all plugin commands (prefixed with "plugin:"), all lexers (prefixed with "lexer:"), and currently opened files (prefixed with "opened file:"). Filter field allows to type hash symbol "#" followed by a letter, to make filtering by category:
1352+
1353+ * #p - plugins
1354+ * #l - lexers
1355+ * #f - opened files
1356+ * #r - recently used files
1357+
1358+You can type those "hash tags" at begin or end of the field, even without separating space. E.g. "bar#p" will show only plugin commands containing "bar", "#f.md" will show only Markdown files (with .md extension).
1359+
1360+# Regular expressions
1361+
1362+Lexer parser uses EControl regex engine. You use this regex syntax only in the "Lexer Properties" dialog in SynWrite, not in the CudaText normal usage. EControl regex has custom features:
1363+
1364+ * class \A: begin of the document
1365+ * class \Z: end of the document
1366+ * class \l: Unicode word-char except the underscore char
1367+ * class \L: inversion to \l
1368+ * lookahead/lookbehind can find match of variable length
1369+ * modifier (?r): \w catches all Unicode letters too
1370+ * modifier (?g): greedy
1371+
1372+CudaText search/replace uses [TRegExpr engine](<https://regex.sorokin.engineer/en/latest/regular_expressions.html>) (by Sorokin, later improved by Alexey Torgashin).
1373+
1374+ * To refer to regex groups in the regular expression itself, in the "Find what" field, use syntax \1 ... \9 and \0 for entire match.
1375+ * To perform replacements with groups, in the "Replace with" field, use syntax $1 ... $9 and $0 for entire match. To use group 1 with following "00", use this: ${1}00.
1376+
1377+## Change case on replaces
1378+
1379+With regex, you can change case of found fragments, use modifiers in replace-with field:
1380+
1381+ * \l - First char to lower
1382+ * \L - All chars to lower
1383+ * \u - First char to upper
1384+ * \U - All chars to upper
1385+
1386+E.g. if found a word, use replace-with field "\L$0" to change word to lowercase (here $0 is group 0, found text).
1387+
1388+Modifiers affect only element after them, element is:
1389+
1390+ * one char (not string), so "\Uabc" and "\uabc" give same result "Abc" (only one char changed),
1391+ * or group $0 ... $9, so modifier changes case of this group (not only one char).
1392+
1393+# Output/Validate panels
1394+
1395+Output and Validate panels are embedded in the bottom panel, they can be shown by clicking their icons in the lower part of the sidebar. These panels allow to highlight (e.g. in blue) lines which match some RegEx. RegEx must be set by plugins which need that.
1396+
1397+ * Plugin "External Tools" highlights the resulting lines in the Output panel, by setting the RegEx from the user tool's properties.
1398+ * Plugin "HTML Tidy" uses Validate panel and sets RegEx for HTML Tidy resulting lines.
1399+
1400+Double-click is reserved in the Output/Validate panels - it is busy here for navigation from the clicked position to the source code. For example, "External Tools" plugin tries to perform this navigation when you double-click lines (even not highlighted lines).
1401+
1402+These panels have hotkeys:
1403+
1404+ * Up/Down/PgUp/PgDown/Home/End: Move selection in list
1405+ * Enter: Try to navigate to source file, like double-click
1406+ * Esc: Focus the editor
1407+ * Ctrl+Del: Clear the entire list
1408+ * Ctrl+C: Copy to clipboard entire list
1409+ * Ctrl+D: Copy to clipboard selected line
1410+
1411+# Dialog Find/Replace
1412+
1413+Find/Replace dialog has hotkeys, which work only when this dialog is focused. Hotkeys can be customized via options "find_hotkey_xxxx".
1414+
1415+ * Alt+Enter: Find first
1416+ * Enter: Find next / Replace next (depends of focused input)
1417+ * Shift+Enter: Find previous
1418+ * Ctrl+Enter: Add new line in multi-line input (multi-line mode is activated by "+" button)
1419+ * Ctrl+Alt+Z: Replace and find next
1420+ * Ctrl+Alt+Shift+Z: Replace and don't find next
1421+ * Ctrl+Alt+A: Replace all occurrences
1422+ * Ctrl+Alt+O: Count all occurrences
1423+ * Ctrl+Alt+E: Select all occurrences
1424+ * Ctrl+Alt+K: Mark all occurrences (with markers)
1425+ * Ctrl+Alt+Q: Extract all RegEx matches
1426+ * and hotkeys to toggle search/replace options (case sensitive, reg.ex., whole words etc)
1427+ * additional not customizable hotkey Ctrl+Down: when input field (find-what or replace-with) is focused, hotkey copies the "find-what" text to "replace-with".
1428+
1429+[![cudatext-find-dlg.png](/wiki-images/2/2c/cudatext-find-dlg.png)](</File:cudatext-find-dlg.png>)
1430+
1431+Toggle-buttons have hotkeys too. Hover mouse over them to see floating tooltips about button functions.
1432+
1433+Toggle-buttons, ie options, are:
1434+
1435+**Toggle-button ".*"**
1436+
1437+Use "regular expressions" engine.
1438+
1439+**Toggle-button "aA"**
1440+
1441+Case sensitive search: "a" will be different from "A".
1442+
1443+**Toggle-button "w"**
1444+
1445+Search for whole words only, ie both sides of found match must be "word boundaries".
1446+
1447+**Toggle-button "O"**
1448+
1449+Wrapped search: search from beginning after reaching the end (with forward search), and search from end after reaching the beginning (with backward search).
1450+
1451+**Toggle-button "[..]"**
1452+
1453+Search in selection only.
1454+
1455+**Toggle-button "+"**
1456+
1457+Toggle multi-line mode for both dialog input fields. To add a newline in multi-line fields, press Ctrl+Enter.
1458+
1459+**Toggle-button "*"**
1460+
1461+Choose allowed syntax elements: Any / Only comments / Only strings / Only comments+strings / etc. This feature must be supported by lexer (and some lexers are limited, support only "comments" or only "strings" syntax elements). Syntax element is detected from left edge position of a found match.
1462+
1463+**Toggle-button "Hi"**
1464+
1465+Highlight all matches for the current search options. Matches are highlighted in the current editor, with the rounded borders, using the color of "SeparLine" syntax theme item. Editor auto-scrolls to the first found match (pretty much like ST3 editor). The limitation of this feature: a highlighted match has the single font color for the entire match, so if a match lays over several syntax tokens (e.g. number, dot, normal word), the entire match will have the single font color anyway.
1466+
1467+**Toggle-button "Im"**
1468+
1469+Immediate search, ie find-as-you-type. When checked, each typing in the "Find what" field finds next match in the editor (or the first match, if input was empty before typing).
1470+
1471+Toggle-buttons for "replace" mode:
1472+
1473+**Toggle-button "?!"**
1474+
1475+Show confirmation on each replace.
1476+
1477+**Toggle-button "$0"**
1478+
1479+"RegEx substitute for 'Replace with'". Activates "substitute" for replace-action. When option is off, the replate-with field is taken literally, without interpreting special constructs. When option is on, the replace-with field is processed for special constructs:
1480+
1481+ * $0: Text of the whole found match
1482+ * $1 ... $9: Text of the found RegEx group with the index 1...9
1483+ * \n: NL char
1484+ * \r: CR char
1485+ * \t: TAB char
1486+ * \f: FF char
1487+ * \a: BEL char
1488+ * \e: ESC char
1489+ * \xNN, \x{NNNN}: hex code of char
1490+ * \l: lower case of one char
1491+ * \L: lower case of all text
1492+ * \u: upper case of one char
1493+ * \U: upper case of all text
1494+
1495+**Toggle-button "AB"**
1496+
1497+Preserve case on replacement. Mimics logic in VS Code program:
1498+
1499+ * If the original string contains only upper-case or only lower-case characters, the result will be either all upper-case or all lower-case characters:
1500+ * "ABCDE" -> replace with "xyz" -> "XYZ" (preserving all upper-case);
1501+ * "abcde" -> replace with "xYz" -> "xyz" (preserving all lower-case).
1502+ * The case of the first character in the original string is always preserved:
1503+ * if it is upper-case, the first character in the result will be upper-case;
1504+ * if it is lower-case, the first character in the result will be lower-case.
1505+ * "Abcde" -> replace with "xyz" -> "Xyz" (preserving the first upper-case);
1506+ * "abcde" -> replace with "Xyz" -> "xyz" (preserving the first lower-case).
1507+ * In case of a mixed-case original string, the result follows the case of characters in the replacing string, excluding the very first character of the original string that always preserves its original case.
1508+ * "ABcde" -> replace with "xyZ" -> "XyZ" (preserving the first upper-case);
1509+ * "abCDE" -> replace with "XYz" -> "xYz" (preserving the first lower-case).
1510+
1511+Action buttons in dialog:
1512+
1513+**Button "| <"**
1514+
1515+Starts the search from document beginning, ignoring the caret position.
1516+
1517+**Button " >"**
1518+
1519+Finds next match, ie continues search forward.
1520+
1521+**Button " <"**
1522+
1523+Finds previous match, ie continues search backward.
1524+
1525+**Button "..."**
1526+
1527+Shows menu with additional actions:
1528+
1529+**"Count all"**
1530+
1531+Count all matches and show the number in the statusbar.
1532+
1533+**"Extract RegEx matches"**
1534+
1535+It's enabled only with RegEx option. Finds all matches, all found matches are put to an internal list, list is sorted, duplicates are discarded, and list is put to a new document. Plugin "Extract Strings" does the same task but using the Python RegEx engine.
1536+
1537+**"Select all"**
1538+
1539+Finds all matches in a document and places multi-seletions on them.
1540+
1541+**"Mark all"**
1542+
1543+Finds all matches in a document and places #Markers on them.
1544+
1545+**Button "Replace"**
1546+
1547+If some fragment was found/selected already, it replaces this fragment (by contents of "Replace with" field). If not, it finds next fragment and selects it. If replacement was performed, it finds/selects the next fragment.
1548+
1549+**Button "Rep all"**
1550+
1551+Performs replacement of all matches in the current document.
1552+
1553+**Button "Rep global"**
1554+
1555+Performs replacement of all matches in all opened documents in all editor groups. After showing the additional confirmation.
1556+
1557+The state of dialog search options is saved to the history file (settings/history.json), and is restored after app restart.
1558+
1559+Button "..." is enabled in "editor mode", so if button is disabled for you, it means CudaText was opened in #Text/Hex viewer mode. "Viewer mode" is activated when you pass the name of huge file with size>500 Mbytes (this is controlled by option "ui_max_size_open").
1560+
1561+## Text searcher features
1562+
1563+1) Search engine supports actions with multi-selections. This makes sense mainly for mass-search actions (Find all, Select all, Mark all, Replace all).
1564+
1565+2) Search engine has the feature, which is rarely implemented in text editors. When invoked on text selection(s) with the option "Search in selection only", engine doesn't place caret+selection on found match, instead it places marker (#Markers). The marker is placed with the underline (triangle with a line to the left), which shows the length of the found match. Actions "Find next"/"Find previuos"/"Replace" support "in selection only" too, they move that mentioned marker. Note that this feature checks the presence of a single marker in text, it may not work OK if you have some markers already placed.
1566+
1567+[![cudatext-find-markers.png](/wiki-images/7/74/cudatext-find-markers.png)](</File:cudatext-find-markers.png>)
1568+
1569+3) Second click on the "Search" sidebar button toggles dialog between Find and Replace modes.
1570+
1571+4) The "Replace all" action has one important feature: when find/replace options
1572+
1573+ * regex
1574+ * whole words only
1575+ * in selection only
1576+ * allowed syntax elements
1577+ * confirm replaces
1578+ * preserve case on replacement
1579+
1580+are all Off - app uses big optimization, making it a lot faster on huge lines. For example, replace of "\r\n" with linebreak char in huge line of length 20M with 900K occurrences: time without optimization in older CudaText versions: 15 mins --> now with optimization: 7 seconds.
1581+
1582+# "Go to line" and other "Go to" dialogs
1583+
1584+**Dialog "Go to line"** (item in the "Search" menu) allows to enter text in formats:
1585+
1586+ * 10 (decimal number): Jump to given line number (to line start).
1587+ * 10:10 (two decimal numbers): Jump to given line and column numbers.
1588+ * 10% (decimal with trailing "%"): Jump to percents of total line count (to line start).
1589+ * d100 (decimal with leading "d"): Jump to absolute decimal offset.
1590+ * xFF00 (hex number with leading "x"): Jump to absolute hex offset.
1591+ * value with leading/trailing "+": Extend selection to this position. For example: if caret is at the 2:2 and you enter "4:10+", editor makes selection from 2:2 to 4:10. Entering "4+" makes selection until start of line 4.
1592+
1593+Also it is possible to call "Go to line" dialog by clicking the statusbar's "caret information" cell (it is the first cell by default).
1594+
1595+**Other "Go to" dialogs.**
1596+
1597+1) Menu item "Search / Go to bookmark". Shows list of all bookmarks, in all opened documents, allows to jump to chosen bookmark.
1598+
1599+2) Project Manager plugin. Menu item "Plugins / Project Manager / Go to file". Shows list of all files in the current project, allows to jump to chosen file in the Project treeview. If option is enabled in the Project Manager, command will also open the chosen file in the editor.
1600+
1601+3) In the "Command Palette" dialog, enter #-char, and tooltip will appear in the Command Palette lower part. It tells how to call via Command Palette:
1602+
1603+ * List of all opened documents with filenames.
1604+ * List of recently opened filenames.
1605+
1606+4) Plugin CudaExt. Gives the command "Code Tree: Symbols list". It shows dialog with list of all symbols from the code-tree for the current document. Note: option "lexer_folding_max_lines" limits the count of document lines, for which code-tree is created. Plugin CudaExt gives 2 additional commands for symbols list: "... (only 1 up level)", "... (only 2 up level)" - they only show symbols from 1-2 top levels of the code-tree.
1607+
1608+# Sessions
1609+
1610+"Session" is a set of opened documents, with properties of each document. CudaText sessions are stored in JSON files with ".cuda-session" extension. Default session file name is "history session.json" in the "settings" folder. CudaText shows name of current session in its window title like "filename.txt {session_name} - CudaText".
1611+
1612+CudaText has options:
1613+
1614+ * "ui_reopen_session": Save last session on closing, and restore it on start.
1615+ * "ui_reopen_session_cmdline": Allow to restore last session even if some file/folder was passed in the command line (or from the Windows Shell Extension). Note, this gives weird behaviour: N program instances will reopen the same last session + passed command-line file. So this option is mainly for the single instance mode.
1616+ * "ui_auto_save_session": On program closing, save current session without asking.
1617+
1618+If some session is opened, program stores document states, on program closing, to session file. If no session is opened, program stores document states to "history files.json" in the "settings" folder.
1619+
1620+Session file contains data:
1621+
1622+ * List of named documents (file names), and unnamed documents
1623+ * For each document:
1624+ * kind of the document: text editor / picture viewer / text viewer (and viewer mode: text/binary/hex/unicode)
1625+ * text of the document, if document is modified
1626+ * undo/redo data, if document is modified
1627+ * read-only state
1628+ * first caret position
1629+ * encoding
1630+ * word-wrap mode
1631+ * lexer
1632+ * bookmarks
1633+ * index of top visible line
1634+ * tab size and "tab as spaces" state
1635+ * minimap and micromap visible state
1636+ * ruler visible state
1637+ * non-printable characters visible state
1638+ * line numbers visible state
1639+ * scale factor
1640+ * list of folded ranges (if lexer supports folding)
1641+ * color of ui-tab (if not default)
1642+ * tab title (if not default)
1643+ * modified state
1644+ * code-tree filter string and history of last filters
1645+ * splitting to 2 editors: on/off, vertical/horizontal, percents of size
1646+ * column of vertical "margin" line, if it's not default
1647+ * For each modified document: date of modification, full document text
1648+ * Last input of "Go to" dialog for each ui-tab
1649+ * Layout:
1650+ * Layout/sizes of side panel and bottom panel
1651+ * Layout/sizes of editor groups
1652+ * Index of active editor group and active tab in each group
1653+
1654+Plugin "Session Manager" is present in Addon Manager, it gives commands to control sessions: open session file, save session, show list of recent sessions, etc. Session Manager also supports files from SynWrite, with .synw-session extension.
1655+
1656+# Char map
1657+
1658+Dialog "Char map" can be called from the "Edit" top menu. It has 2 modes:
1659+
1660+ * ANSI: Shows ANSI char codes from 0 to 255 (codes 128..255 map to different Unicode codes, this depends on active OS locale).
1661+ * Unicode: Shows almost all Unicode code points, they are divided to groups. Change active group using combobox at the bottom.
1662+
1663+Click any cell in the grid to insert this char at caret position. Or select a cell with arrow keys and press Enter.
1664+
1665+[![cudatext-charmap.png](/wiki-images/b/bb/cudatext-charmap.png)](</File:cudatext-charmap.png>)
1666+
1667+# Tab switcher
1668+
1669+CudaText has option "ui_tab_switcher_dialog", which activates modern tab switcher for Ctrl+Tab hotkey. This is dialog which allows to switch tab using visit history. For example: press Ctrl, Tab, Tab, Tab, release Ctrl: this goes 3 steps back in the visit history. Visit history is updated on tabs activation (activated tab moves to the top of history).
1670+
1671+Dialog lists documents from all tab-groups, with prefixes: "[3-1] /home/user/filename.cpp" for 1st tab in 3rd group.
1672+
1673+[![cudatext-tab-switcher.png](/wiki-images/c/c1/cudatext-tab-switcher.png)](</File:cudatext-tab-switcher.png>)
1674+
1675+Alternative way is plugin CudaExt. Plugin gives the command "Choose tab to switch to". You need to assign hotkey Ctrl+Tab to this command (hotkey will be removed from built-in tab switcher). Plugin's dialog is richer than CudaText's dialog: it allows to switch to Console/Output/Validate panels, it allows to cancel the operation.
1676+
1677+ * When plugin's switcher is called with pressed Ctrl-key, it shows the dialog.
1678+ * When plugin's switcher is called without Ctrl-key pressed, it immediately switches to previous tab.
1679+
1680+[![cudatext-tab-switcher-cudaext.png](/wiki-images/5/54/cudatext-tab-switcher-cudaext.png)](</File:cudatext-tab-switcher-cudaext.png>)
1681+
1682+Command Palette has several commands to switch current ui-tab:
1683+
1684+ * "ui: switch tab, to next": If option "ui_tab_switcher_dialog" is true, command shows menu-like dialog with suggestion to activate recent tab (using visit history). If option is off, command just activates the next ui-tab ignoring the visit history.
1685+ * "ui: switch tab, to previous": If option "ui_tab_switcher_dialog" is true, the same as above. If option is off, command just activates the previous ui-tab ignoring the visit history.
1686+ * "ui: switch tab, simply to next": Activates the next ui-tab, ignoring the visit history. (It considers only visual order of ui-tabs).
1687+ * "ui: switch tab, simply to previous": Like above but in reverse order.
1688+ * "ui: switch tab, to recent": Activates the ui-tab previously activated in visit history.
1689+
1690+# Minimap
1691+
1692+Minimap is wide vertical bar near editor's right side (it can be shown on the left side too, by option). To show it:
1693+
1694+ * Set the option "minimap_show" (show permamently)
1695+ * Use menu item "View / Toggle minimap" (show temporary, for the current document only)
1696+
1697+If you drag mouse over minimap, editor will scroll entirely from top to bottom, even for huge documents (mimics Sublime Text behaviour). Text in minimap is painted by pixels, not by font rendering. Minimap is scaled according to CudaText UI, but can be scaled separately too (option "minimap_scale"). Screenshot shows 2 windows with different minimap scale.
1698+
1699+[![cudatext-minimap.png](/wiki-images/3/3c/cudatext-minimap.png)](</File:cudatext-minimap.png>)
1700+
1701+CudaText UI-theme doesn't have separate color for minimap slider. CudaText calculates the color of slider (when slider is hovered by mouse): if text background color is light - slider color is darker by 5-10% (there is no option); if text background color is dark - slider color is lighter by 5-10%.
1702+
1703+Feature: for document line(s) affected by selection(s), minimap lines have additional full-width background coloring. This feature cannot be turned off yet.
1704+
1705+Feature: minimap rendering time is limited by 40 msec (no option for this yet). For rather slow CPU and maximized app window, the entire minimap rendering can take more time, so bottom minimap lines won't be colored at all.
1706+
1707+# Micromap
1708+
1709+Micromap is thin vertical bar near editor's right side. It is not scrollable, it shows overview of entire document from top to bottom. To show it:
1710+
1711+ * set option "micromap_show": to show micromap permanently for all documents.
1712+ * use menu item "View / Toggle micromap": to show micromap for the current document only.
1713+
1714+Micromap has several thin columns (from column 1 to column 3, but this can be changed by plugins) for different categories of marks. It shows:
1715+
1716+ * full-width single mark: 'thumb', ie current visible area of editor.
1717+ * on column 1 (leftmost): #Line_states marks.
1718+ * on column 2:
1719+ * marks from plugin Spell Checker (default color: reddish);
1720+ * marks from plugin Highlight Occurrences (default color: blue); mark with UI-theme color "editor, line states, changed" means that it is "Highlight Occurrences" mark which corresponds to the current caret position (only for the first caret);
1721+ * marks for bookmarks; these marks re-use UI-theme color "editor, line states, added".
1722+ * on column 3: marks for selection(s), useful for example when command "Find / Select all" makes many selections.
1723+
1724+[![cudatext-micromap .png](/wiki-images/8/8e/cudatext-micromap_.png)](</File:cudatext-micromap_.png>)
1725+
1726+Plugins can place marks on micromap, e.g. plugin "Highlight Occurrences" places marks for highlighted fragments, plugin "Spell Checker" places marks for misspelled words.
1727+
1728+Micromap can be rendered directly on the vertical scrollbar (when scrollbar is application-painted). To use that, you need 2 options:
1729+
1730+ * `"scrollbar_themed": true`
1731+ * `"micromap_on_scrollbar": true`
1732+
1733+Picture shows micromap on the scrollbar: [![cudatext-micromap-on-scrollbar.png](/wiki-images/7/72/cudatext-micromap-on-scrollbar.png)](</File:cudatext-micromap-on-scrollbar.png>)
1734+
1735+Micromap visible state is not restored from history for files, which have line count bigger than value of option "wrap_enabled_max_lines" (default is 60K lines).
1736+
1737+In rather big documents (e.g. 2000+ lines), micromap renders the horizontal line near the bottom. What is this line? This line denotes the maximal position which you can click. Space below that line is 'reserved' for the micromap 'thumb'. 'Thumb' height is limited by 16 pixels, so last 16 pixels are reserved to render the 'thumb' nicely, when you scroll to the very bottom.
1738+
1739+# Paste with middle-button-click
1740+
1741+To paste like in Linux/Unix, with middle-click, you need:
1742+
1743+ * Set option "mouse_middle_click" to value 2 (in the user.json).
1744+ * Set option "auto_copy_clp". Option supports pasting to usual editors (inside UI-tabs) and also to one-line input fields (Find/Replace, Console, Code-Tree filter).
1745+
1746+# Full-screen mode
1747+
1748+There are two menu items in the View menu:
1749+
1750+ * Toggle **Full-screen**. This maximizes app window (in a special way, OS-dependent, even OS taskbar hides), and also, optionally, turns off some UI elements: toolbar, statusbar, sidebar, side panels (Tree, Project, FTP), bottom panels (Console) etc. Option "ui_fullscreen" has set of chars, each char for one UI element to hide. E.g. option value "tp" hides 2 UI elements ("t" for toolbar, "p" for side panels).
1751+ * Toggle **Distraction-free**. Like full-screen, but also all UI elements hide (gutter, statusbar, toolbar, sidebar, side panels). No option currently to configure which elements hide.
1752+
1753+Notes:
1754+
1755+ * In the Distraction-free mode, app uses option "centering_for_distraction_free" to center the text visually. If you want this centering w/o Distraction-free mode, use the option "centering_width".
1756+ * On macOS full-screen modes hide the top menu bar. To show it w/o returning back, just move the mouse cursor to the top of the screen and hold there for few seconds.
1757+
1758+# Python integration
1759+
1760+## Python on Windows
1761+
1762+On Windows, Python engine (2022/10: currently it is 3.8) is preinstalled. CudaText finds files "python3*.dll" in its folder, and uses file with the latest version number. No options exist to change this.
1763+
1764+You can use different Python version. From CudaText's Addon Manager, install appropriate package, e.g. "Windows_Python37_64bit", and restart the program.
1765+
1766+Python engine requires Visual C++ Redistributable for Visual Studio 2015 (32-bit or 64-bit, same as CudaText). Download it from Microsoft site.
1767+
1768+So, files needed for Python 3.8 are:
1769+
1770+ * "python38.zip"
1771+ * "python3.dll"
1772+ * "python38.dll"
1773+ * "python38dlls" - folder with about 18 *.pyd files
1774+ * "vcruntime140*.dll" - Microsoft runtime
1775+
1776+File "python3.dll" without exact version: this file is sometimes needed for Python plugins to work property. For example, file is needed for plugin FTP with SFTP support (plugin crashes and shows errors in the Console if "python3.dll" is absent). Almost each package "Windows_Python3x_xxxx" contains this file.
1777+
1778+Note for Windows 7. You also need the Update for Universal C Runtime in Windows (KB2999226). Download it from the Microsoft site.
1779+
1780+## Python on Windows XP
1781+
1782+Install the package "Windows Python34 32bit". Download it from [SourceForce folder addons/packages](<https://sourceforge.net/projects/cudatext/files/addons/packages/>), and unzip to CudaText folder.
1783+
1784+No options are needed to configure this older Python, but you need to delete all newer Pythons from CudaText folder:
1785+
1786+ * python*.dll: must be deleted
1787+ * python*.zip: can be left as is
1788+ * files *.pyd: can be left as is
1789+
1790+Proper old version of "requests" is now included in the "Windows Python34 32bit". But if you miss it somehow, do additional steps:
1791+
1792+ * New versions of "requests" lib don't work, ie Addons Manager crashes. So you need to downgrade the "requests" lib. Get old version 2.5.x from <https://pypi.org/project/requests/#history> and update the folder "py/sys/requests".
1793+ * After you downgrade the "requests", you may get Addons Manager errors about HTTPS certificate. To fix that, replace outdated file "py\sys\requests\cacert.pem" with the new one from "py\sys\certifi\cacert.pem".
1794+
1795+## Python on Linux, BSD, Solaris
1796+
1797+Linux/*BSD/Solaris version uses Python library from OS. Install Python 3.x (usually already installed). Instruction, if Python library was not automatically used:
1798+
1799+ * Open file manager, go to /usr
1800+ * Search for "libpython3.*so*"
1801+
1802+Or use the terminal command:
1803+```
1804+$ find /usr -name 'libpython3.*so*' 2>/dev/null
1805+```
1806+
1807+ * If not found, install Python 3.x, and search again.
1808+ * Set option "pylib__linux" ("pylib__freebsd", "pylib__solaris") in the "user.json" config, to one of the found filenames. Write option to the "user.json" or course, not "default.json".
1809+
1810+Typical value for Ubuntu:
1811+```
1812+"pylib__linux" : "/usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0",
1813+```
1814+
1815+Typical value for Solaris 11.4 x86:
1816+```
1817+"pylib__solaris" : "/usr/lib/amd64/libpython3.5m.so",
1818+```
1819+
1820+## Python on macOS
1821+
1822+On macOS you must install Python 3, from official site python.org. Versions 3.6...3.12 are OK. CudaText will detect this Python. CudaText has option "pylib__mac" with such default value (actual version number is auto-detected):
1823+```
1824+"pylib__mac": "/Library/Frameworks/Python.framework/Versions/3.5/lib/libpython3.5.dylib",
1825+```
1826+
1827+macOS 15 and newer: some users report that the above path was changed to:
1828+```
1829+"pylib__mac": "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/libpython3.9.dylib",
1830+```
1831+
1832+If you use Homebrew to install Python on MacOS, CudaText cannot detect it, so you need to write to the "user.json" option "pylib__mac" by hands. Example:
1833+```
1834+"pylib__mac": "/usr/local/Cellar/python@3.9/3.9.1_3/Frameworks/Python.framework/Versions/3.9/lib/libpython3.9.dylib",
1835+```
1836+
1837+If you use "virtualenv" from Anaconda with isolated Python, CudaText cannot detect it, so you need to write to the "user.json" option "pylib__mac" by hands. Example:
1838+```
1839+"pylib__mac": "/miniconda2/envs/py3/lib/libpython3.7m.dylib",
1840+```
1841+
1842+Note: Please remember to change your version in the variable string to match the version you have installed.
1843+
1844+# Line states
1845+
1846+In the gutter bar, you can see colored thin bars next to line numbers: greenish, yellowish. It is line states. They show state of lines:
1847+
1848+ * normal: they have no special color on gutter
1849+ * changed: edited since last saving
1850+ * added: newly inserted lines
1851+ * saved: previously changed/added but saved on last saving
1852+
1853+[![cudatext-line-states .png](/wiki-images/2/26/cudatext-line-states_.png)](</File:cudatext-line-states_.png>)
1854+
1855+Line states help to see which lines were edited since the last opening of a file / last saving of a file. CudaExt plugin gives few commands for line states:
1856+
1857+ * "Jump: to next/previous changed lines"
1858+ * "Jump: to next/previous working lines"
1859+ * "Jump: to next/previous saved lines"
1860+
1861+# How to change icons
1862+
1863+Screenshot shows 3 icon sets at once:
1864+
1865+ * on the main toolbar (horizontal)
1866+ * on the sidebar (vertical)
1867+ * on the Project Manager toolbar (horizontal, below "Project" text)
1868+
1869+[![cudatext all icons.png](/wiki-images/1/14/cudatext_all_icons.png)](</File:cudatext_all_icons.png>)
1870+
1871+**Icons on the main toolbar**
1872+
1873+To change them:
1874+
1875+ * (Optional) Install add-on(s) of kind "toolbar theme" (each add-on gives additional icon set or several sets).
1876+ * Change option "ui_toolbar_theme" in user.json. Option value is some subfolder in data/toolbaricons.
1877+ * Restart CudaText.
1878+
1879+Note that plugin "Options Editor Lite" makes it easy - for options "ui_toolbar_theme"/"ui_sidebar_theme"/"ui_tree_theme" it shows the combobox dropdown, which is easy to change.
1880+
1881+**Icons on the sidebar**
1882+
1883+To change them:
1884+
1885+ * (Optional) Install add-on(s) of kind "sidebar theme".
1886+ * Change option "ui_sidebar_theme" in user.json. Option value is some subfolder in data/sideicons.
1887+ * Restart CudaText.
1888+
1889+**Icons on the Project Manager toolbar**
1890+
1891+To change them:
1892+
1893+ * (Optional) Install add-on(s) of kind "proj toolbar theme".
1894+ * Change option in the dialog: "Options / Settings-plugins / Project Manager / Config".
1895+ * Restart CudaText.
1896+
1897+**Icons in the Project Manager file list**
1898+
1899+[![cudatext-project-icons.png](/wiki-images/b/bf/cudatext-project-icons.png)](</File:cudatext-project-icons.png>)
1900+
1901+To change them:
1902+
1903+ * Install add-on(s) of kind "file type icons".
1904+ * Change option in the dialog: "Options / Settings-plugins / Project Manager / Config".
1905+ * Restart CudaText.
1906+
1907+**Icons on UI-tab titles**
1908+
1909+[![cudatext-tab-icons.png](/wiki-images/9/98/cudatext-tab-icons.png)](</File:cudatext-tab-icons.png>)
1910+
1911+You must install plugin "Tab Icons" from Addons Manager. It will show icons on UI-tabs (only for known file types). Plugin also allows to set custom icons for UI-tabs. Use right-click menu over UI-tab, and menu item "Set tab icon...". This shows menu with predefined custom icons, shipped with "Tab Icons" plugin. You can add *.png 16x16 icons there too, folder is "(CudaText)/data/tabsicons" (create folder if needed).
1912+
1913+**Icons in the Code-Tree panel**
1914+
1915+[![atsynedit tree.png](/wiki-images/f/f8/atsynedit_tree.png)](</File:atsynedit_tree.png>)
1916+
1917+To change them:
1918+
1919+ * Install add-on(s) of kind "codetreeicons" (each add-on gives additional icon set).
1920+ * Change option "ui_tree_theme" in user.json. Option value is some subfolder in data/codetreeicons.
1921+ * Restart CudaText.
1922+
1923+# Toolbar
1924+
1925+CudaText has toolbar on the top, which can be shown by menu item "View / Toggle toolbar".
1926+
1927+[![cudatext-toolbar.png](/wiki-images/f/f5/cudatext-toolbar.png)](</File:cudatext-toolbar.png>)
1928+
1929+To customize it, install plugin "Config Toolbar" from Addon Manager. Plugin gives command (menu "Plugins / Config Toolbar / Customize buttons") to customize toolbar contents: simple buttons, buttons with dropdown menus, separators, icons for buttons.
1930+
1931+Plugin also gives command "Hide standard buttons" which allows to hide default CudaText buttons from toolbar. This command shows input box for space-separated indexes of buttons. What are these indexes? Indexes are 0-based numbers of all toolbar items: first button (New File) is index 0, next item (dropdown near New File) is index 1, next item (Open File) is index 2, etc (all separators also have index). So for example, to hide 3rd + 10th items, enter "2 9" into that input box.
1932+
1933+# Configurable statusbar
1934+
1935+Statusbar is fully configurable: you can change order/visibility of cells, width and alignment of cells. Option "ui_statusbar_panels" configures set of cells. Predefined cells are:
1936+
1937+ * **Carets info**. Click on it shows Go To dialog.
1938+ * **Encoding name**. Click on it shows menu to change encoding of document.
1939+ * **Line-ends characters**. Click on it shows menu to change line-ends in entire document.
1940+ * **Lexer name**. Click on it shows lexers menu.
1941+ * **Tab-char size**. Shows "Tab: 4" if Tabulation-key inserts tab-char, or "Spaces: 4" if Tabulation-key inserts spaces. Click on it shows menu:
1942+ * To change tabulation size (for the active document).
1943+ * To change mode "Tabulation-key inserts spaces".
1944+ * 2 items for actions "Convert indentation to spaces", "Convert indentation to tabs" like in Sublime Text.
1945+ * **Text insert/overwrite mode** , toggled by Ins-key. Shows "Ins" or "Ovr".
1946+ * **Mouse selection mode** : "-" for normal mode, "||" for column mode (mouse dragging makes column selection even without Alt+ key).
1947+ * **Message** from program or plugins (usually it's last auto-sized cell).
1948+ * **Word-wrapping mode**. Cell is hidden by default. Shows one of possible 3 modes:
1949+ * No wrapping.
1950+ * Wrapping at window edge.
1951+ * Wrapping at fixed margin (set it by "margin" option).
1952+ * **Font zoom value** in percents. Cell is hidden by default.
1953+
1954+The cell "carets info" shows value of one of options:
1955+
1956+ * **"ui_statusbar_no_sel"** : Used when there is no selection
1957+ * **"ui_statusbar_small_sel"** : Used when there is single-line selection
1958+ * **"ui_statusbar_str_sel"** : Used when selection is multi-line
1959+ * **"ui_statusbar_col_sel"** : Used for column-selection mode
1960+ * **"ui_statusbar_carets"** : Used when 2 or more carets are placed
1961+
1962+In the above "ui_statusbar_" options, macros are supported:
1963+
1964+ * {y}: line index of first caret
1965+ * {y2}: line index of last caret
1966+ * {yb}: line index of first selection beginning
1967+ * {ye}: line index of first selection ending
1968+ * {x}: column index of first caret, tab-chars counted as 1
1969+ * {xx}: column index of last caret, tab-chars expanded
1970+ * {count}: total number of lines
1971+ * {carets}: total number of carets
1972+ * {sel}: number of lines affected by selection(s)
1973+ * {selchars}: number of selected characters, for all kinds of selections
1974+ * {cols}: number of columns in column selection
1975+ * {char}: character at first caret (empty if no char)
1976+ * {char_dec}: character at first caret - decimal code (empty if no char)
1977+ * {char_hex}: character at first caret - 2...4-digit hex code (empty if no char)
1978+ * {char_hex4}: character at first caret - 4-digit hex code (empty if no char)
1979+ * {_ln}: localized string "Ln"
1980+ * {_col}: localized string "Col"
1981+ * {_sel}: localized string "sel"
1982+ * {_linesel}: localized string "lines sel"
1983+ * {_carets}: localized string "carets"
1984+
1985+An option exists to change the delay of messages in the statusbar.
1986+
1987+This is not used in the main statusbar, but plugin API allows to colorize statusbar cells (used by Vim Mode plugin), and to show icons there.
1988+
1989+# Text/Hex viewer
1990+
1991+CudaText has internal file viewer, for files on unlimited size. Viewer is based on different component: not ATSynEdit but ATBinHex. Viewer loads into memory only visible portion of file, so viewer is fast for files of any size. To activate the viewer for normal small text files, use these Command Palette commands:
1992+
1993+ * file: open file, in text viewer
1994+ * file: open file, in hex viewer
1995+ * file: open file, in unicode viewer
1996+ * plugin: Cuda-Ext: File: Show in hex viewer (this command is from CudaExt plugin)
1997+
1998+Viewer component supports several modes:
1999+
2000+ * Text mode: 1-byte encoding, variable line length
2001+ * Binary mode: 1-byte encoding, fixed width (line breaks are ignored)
2002+ * Hex mode: 1-byte encoding, fixed width
2003+ * Unicode mode: like Text, but in UTF-16 encoding
2004+ * Unicode/Hex mode: like Hex, but in UTF-16 encoding
2005+
2006+Combined screenshot shows the different modes in action: Text, Binary, Hex, Unicode.
2007+
2008+[![cudatext-viewer-modes.png](/wiki-images/5/5c/cudatext-viewer-modes.png)](</File:cudatext-viewer-modes.png>)
2009+
2010+CudaText suggests to use viewer for files of too big size (bigger than option "ui_max_size_open"). And for files with binary contents.
2011+
2012+[![cudatext-viewer-asking.png](/wiki-images/7/7e/cudatext-viewer-asking.png)](</File:cudatext-viewer-asking.png>)
2013+
2014+Viewer has only limited search support, ie not all Find-dialog options are enabled, when file viewer is active. Viewer allows to use "Go to" dialog. In the "Go to" dialog, you can enter "2000" to jump to hex offset 0x2000 (in hex mode, rounded to 16 bytes). If you enter "50%", viewer will jump to the middle. Viewer supports selection of block by mouse, and hotkeys Ctrl+A (Select all), Ctrl+C (Copy to clipboard). Viewer supports double-click to select whole word.
2015+
2016+In viewer mode, you can click statusbar fields:
2017+
2018+ * Encoding field. You can change viewer encoding only in non-Unicode modes.
2019+ * Mode field, to change view mode: Text, Binary, Hex, Unciode, Unicode/Hex.
2020+
2021+**Q: How to open file in viewer?**
2022+
2023+A1: If file is too big, CudaText suggests to use viewer automatically - see screenshot of the helper dialog above. If file is not too big, you can switch from the editor to viewer. You need the plugin CudaExt which gives the Command Palette command: **"Cuda-Ext: File: Show in hex viewer"**. After that, you can change viewer-mode via statusbar click: Text / Binary / Hex / etc. To switch back to the editor, use Command Palette command: **"Cuda-Ext: File: Show in text editor"**.
2024+
2025+A2: Start CudaText without any files, and call Command Palette item **"file: open file, in text viewer"**. It shows the Open File dialog and then loads file directly into viewer. Again, you can change viewer-mode via statusbar click: Text / Binary / Hex / etc.
2026+
2027+A3: Start CudaText from Terminal (console) like this:
2028+```
2029+cudatext -z=text FileName
2030+ cudatext -z=binary FileName
2031+ cudatext -z=hex FileName
2032+```
2033+
2034+# Picture file viewer
2035+
2036+CudaText has the emdedded picture file viewer. Picture mode is activated for files with several known extensions:
2037+
2038+ * BMP
2039+ * PNG
2040+ * JPEG, JPG
2041+ * GIF
2042+ * ICO (Windows icon)
2043+ * WEBP, it requires libwebp library: on Windows it is file libwebp32.dll / libwebp64.dll in the CudaText folder; on Linux/Unix it is file libwebp.so.6 in system folder
2044+ * PSD (Photoshop image)
2045+ * TGA (Targa)
2046+ * CUR (Windows cursor)
2047+
2048+Viewer supports zooming of an image:
2049+
2050+ * use Ctrl + mouse wheel
2051+ * click the statusbar cell with the zoom value, and choose one of predefined zoom values: 33%, 50%, 100%, 150%, 200%, 500%, 1000%, 1500%.
2052+
2053+While picture is zoomed so that it's bigger than the current window, you can drag the picture by mouse.
2054+
2055+While picture viewer is active, Find/Replace dialog is disabled.
2056+
2057+# Pair brackets
2058+
2059+CudaText has built-in pair bracket finder. Bracket finder can highlight pair brackets, when there is only single caret, and no selection is placed. It finds symbols "()[]{}<>" (configurable per lexer via lexer-specific configs). Bracket finder respects lexer context: it skips symbols inside syntax "comments" and syntax "strings". If caret is placed not directly on/after a bracket, program will find nearest surrounding brackets.
2060+
2061+(Long time ago, plugin "Bracket Helper" was needed for this feature, later it was removed from add-ons.)
2062+
2063+There are several options:
2064+
2065+ * "bracket_highlight"
2066+ * "bracket_symbols" (includes only symbols ()[]{} by default, but you can enable symbols <> for example in HTML lexer specific config)
2067+ * "bracket_distance"
2068+ * "auto_close_brackets"
2069+
2070+There are several commands in the Command Palette:
2071+
2072+ * brackets: pair highlight: on
2073+ * brackets: pair highlight: off
2074+ * brackets: pair highlight: toggle
2075+ * brackets: jump to pair
2076+ * brackets: select to pair
2077+ * brackets: select to pair, inside (it makes selection smaller by 2 characters)
2078+
2079+## Brackets auto-pairing logic
2080+
2081+Auto-pairing of brackets is controlled by the option "auto_close_brackets". Option supports auto-pairing of brackets and some other chars (quotes, tilde etc).
2082+
2083+**For single caret**
2084+
2085+ * If selection is present, and opening bracket is typed, CudaText encloses the selection into 2 paired chars, like "(selection)".
2086+ * If there is no selection, and char is typed (not only bracket-char, but any char from the option), CudaText inserts 2 paired chars like "()", moving the caret inside that pair. Incorrect contexts for the pairing are:
2087+ * Context "\|" - caret is after backslash.
2088+ * Context "|w" - char after caret is not one of :;.,=>.
2089+ * Context "w|" - quote-char (single quote, double quote, backtick) is typed after a word-char.
2090+ * If there is no selection, and closing bracket is typed, CudaText may ignore this char or not, it depends on context:
2091+ * Context "f(|)" - app ignores closing bracket and only moves caret righter.
2092+ * Context "f(text|)" - new closing bracket is added.
2093+
2094+**For multi-carets**
2095+
2096+CudaText first looks at contexts of all carets. If at least one caret has "not suitable" context, app does not do the pairing, for all carets. So pairing is performed for all or nothing.
2097+
2098+For caret with selection, context is considered as OK. And typed char will enclose the selection for that caret.
2099+
2100+## Auto-deletion of pair brackets
2101+
2102+BackSpace key supports deletion of both brackets at once. Only for bracket chars listed in the "bracket_symbols" option. It is supported when all carets have the 'good situation', ie this (caret is shown by "|"):
2103+```
2104+(|)
2105+ [|]
2106+ {|}
2107+```
2108+
2109+or this, with additional spaces:
2110+```
2111+(| )
2112+ [| ]
2113+ {| }
2114+```
2115+
2116+When all carets have this 'good situation', BackSpace deletes both brackets at once. When at least one caret does not have the 'good situation', BackSpace performs usual deletion of single character on the left.
2117+
2118+# Word jump commands
2119+
2120+CudaText provides several word-jump commands, see them in the Command Palette by entering "go to word":
2121+
2122+ * go to word next
2123+ * go to word next + select
2124+ * go to word next, simple
2125+ * go to word next, simple + select
2126+ * go to word previous
2127+ * go to word previous + select
2128+ * go to word previous, simple
2129+ * go to word previous, simple + select
2130+ * go to word end
2131+ * go to word end + select
2132+
2133+"Go to word next" vs "Go to word end"?
2134+
2135+ * "...next" - jumps to the next word start (left word boundary).
2136+ * "...end" - jumps to the end of the current word (right word boundary), and after that it jumps to the next word end too.
2137+
2138+For example, Windows 7 Notepad performs "...next" on pressing Ctrl+Right, while Sublime Text 3 performs "...end" on pressing Ctrl+Right. To configure Ctrl+Right (and Shift+Ctrl+Right) behaviour, re-assign this hotkey from one command to another - to reassign it, press F9 in the Command Palette dialog.
2139+
2140+"Go to word next" vs "Go to word next, simple"?
2141+
2142+ * "..., simple" command performs simplified jump, it treats all alpha-numerical characters and symbols (#$%^&@ etc) as one group, so it makes single jump over "test@#some!" string.
2143+ * "Go to word next" treats alpha-numericals and symbols as different char groups, and stops at the beginning of each group.
2144+
2145+Plugin CudaExt provides such related commands:
2146+
2147+ * Cuda-Ext: Jump: Left into CamelCase/snake_case
2148+ * Cuda-Ext: Jump: Right into CamelCase/snake_case
2149+
2150+# Sorting and finding duplicate lines
2151+
2152+CudaText has two sorting methods.
2153+
2154+**Method 1: Plugin "Sort"**. It supports Undo for its commands. It works not fast and takes lot of memory on sorting. It cannot sort some huge files, because it reads document contents from Pascal memory buffer to Python memory buffers.
2155+
2156+Commands in the menu "Plugins / Sort" and in the Command Palette:
2157+
2158+ * Sort ascending
2159+ * Sort descending
2160+ * Sort ascending, ignore case
2161+ * Sort descending, ignore case
2162+ * Sort dialog... (shows all sorting options in dialog)
2163+ * Reverse lines
2164+ * Shuffle lines
2165+ * Remove duplicate lines
2166+ * Remove duplicate lines, but keep blanks
2167+ * Remove duplicate lines + origins
2168+ * Remove adjacent duplicate lines (ie nearest repeated lines)
2169+ * Extract duplicate lines (put duplicate lines to a new document)
2170+ * Extract duplicate lines, ignore case
2171+ * Extract unique lines
2172+ * Remove blank lines
2173+ * Remove adjacent blank lines
2174+ * Ini file: sort sections and keys
2175+ * Ini file: sort sections, but not keys
2176+ * Sort e-mail list by domain (lines should be valid email addresses to sort them by domain)
2177+
2178+The advantage of "Sort" plugin is that is has additional commands (for duplicate lines, for ini files, for e-mails).
2179+
2180+Plugin has config file, you can edit it via menu item "Options / Settings-plugins / Sort". In the section [sort] you can change option "allow_sort_all_when_none_selected" to 0 or 1 to disable/enable sorting of entire document, if nothing is selected. If selection exists (single selection), plugin handles only selected lines.
2181+
2182+**Method 2: Pascal-based sorting commands** , which are named in the Command Palette like "(without undo) sort...". They clear current Undo (ie user cannot undo sorting operation), but they are optimized for speed and memory. Commands don't read document contents into additional buffers, they sort lines in-place (changing pointers only). So these commands work with any files which CudaText can load.
2183+
2184+Commands in the Command Palette are:
2185+
2186+ * (without undo) sort ascending
2187+ * (without undo) sort ascending, ignore case
2188+ * (without undo) sort descending
2189+ * (without undo) sort descending, ignore case
2190+ * (without undo) delete all blank lines
2191+ * (without undo) delete adjacent blank lines
2192+ * (without undo) delete all duplicate lines
2193+ * (without undo) delete all duplicate lines, keep blanks
2194+ * (without undo) delete adjacent duplicate lines
2195+ * (without undo) reverse lines
2196+ * (without undo) shuffle lines
2197+
2198+These built-in commands handle only the range of selected lines, if selection exists (only first selection is handled).
2199+
2200+# Markers
2201+
2202+"Markers" are text positions which are shown with red (color in default theme) triangles below them. CudaText gives such commands in the Command Palette:
2203+
2204+ * "markers: drop marker at caret": Adds a marker on current caret position.
2205+ * "markers: go to last marker (don't delete)": Moves caret to the last placed marker without deleting it.
2206+ * "markers: collect last marker (delete)": Moves caret to the last placed marker and deletes it.
2207+ * "markers: remove all": Removes all markers in the current document.
2208+ * "markers: swap caret and last marker": Moves caret to the last placed marker, deletes this marker, and adds marker on the previous caret position. Command is to jump to the last marker, second command call jumps back, 3rd command call jumps back, etc.
2209+ * "markers: select to last marker": Makes text selection from caret position to the position of last placed marker.
2210+ * "markers: delete to last marker": Deletes text from caret position to the position of last placed marker.
2211+
2212+Markers are utilized by the Snippets plugin.
2213+
2214+[![cudatext-markers-html.png](/wiki-images/2/29/cudatext-markers-html.png)](</File:cudatext-markers-html.png>)
2215+
2216+Snippets plugin finds tab-stops in the inserting snippet text, and places markers for them. After markers are placed by Snippets plugin, Tab-key works in special way - it runs command "collect last marker", ie it jumps to the next marker ("next" by the order of tab-stop: 1, 2, 3... tab-stop 0 is the last). When user collects all markers by Tab-key, this special mode deactivates and Tab-key works as usual again. Command "markers: remove all" also deactivates that mode.
2217+
2218+Note about command "Add next occurrence of selected word". This command finds next occurrence, and adds marker (with underline) for the last added selection. This marker is special: it's intended only for this command, and it's auto-removed on a) "Cancel carets" command, b) any text changing, c) mouse click. The reason for this marker is to support "wrapped" search: command runs "wrapped" search when it reaches the document end.
2219+
2220+# Dialog "Save tabs"
2221+
2222+Dialog "Save tabs?" shows on CudaText closing, if at least one document is modified and not saved to disk. Dialog lists all modified file-tabs (usually one file per one file-tab, but it's allowed to have 2 files in a single file-tab). Checkmarks (all checked by default) are used to check/uncheck file-tabs which will be saved on pressing "Save" button. For untitled documents to be saved, program will show "Save as" prompts. Button "Don't save" closes dialog and program, losing modifications. Button "Cancel" closes the dialog, but not the program.
2223+
2224+CudaText has the option "ui_reopen_session". When it is true, dialog "Save tabs?" shows additional button: "Don't save / Keep in session", which doesn't save disk files, but stores modified documents to active "session" file. Program will read it on start.
2225+
2226+Also CudaText gives the command "dialog: save tabs" in the Command Palette. It shows the same dialog, the difference is that buttons do not close the program.
2227+
2228+# Hex display of special chars
2229+
2230+Editor shows some characters in a "hex form", like "x2000" for character U+2000. For codes below 0x100, hex form is shorter, like "x01" for character U+0001. If single-byte encoding is used (e.g. cp437), then only the short hex form is used. Hex form is rendered with different font color.
2231+
2232+[![cudatext-hex-chars.png](/wiki-images/8/80/cudatext-hex-chars.png)](</File:cudatext-hex-chars.png>)
2233+
2234+Special characters which are always rendered in the hex form (this is not configurable):
2235+
2236+ * U+0000...U+001F, except Tab-char U+0009
2237+ * U+2000...U+200F: white spaces + specials
2238+ * U+2028...U+202F: white spaces + specials
2239+ * U+2066...U+2069
2240+ * U+0085
2241+ * U+061C
2242+ * U+FEFF
2243+
2244+# Tabs features
2245+
2246+Control of UI tabs is named ATTabs, and has many features:
2247+
2248+ * Pseudo-tab "+" at the end. Option "ui_tab_show_plus".
2249+ * Scrolling arrows (on the left by default), to scroll tabs when there are lot of them and they don't fit. Thin scrolling indicator auto-appears on the top (default color is red).
2250+ * Drop-down arrow (on the right by default), to show menu of all tabs in the current group.
2251+ * Tabs can be placed on all 4 sides: top, bottom, left, right. Option "ui_tab_position".
2252+
2253+[![cudatext-tabs-left .png](/wiki-images/c/c8/cudatext-tabs-left_.png)](</File:cudatext-tabs-left_.png>)
2254+
2255+ * Layout of "arrows" is customizable. Option "ui_tab_button_layout". Button "+" is available, to replace "+" pseudo-tab, this button is always visible (pseudo-tab can be scrolled away). Button "x" is available, to close the current tab. Screenshot shows the layout with all possible buttons placed on the left.
2256+
2257+[![cudatext-tabs-layout.png](/wiki-images/f/f2/cudatext-tabs-layout.png)](</File:cudatext-tabs-layout.png>)
2258+
2259+ * Tabs can be multi-line. In multi-line mode, tabs-control changes its own height. But this height is limited by 2/3 of the window height. Option "ui_tab_multiline".
2260+
2261+[![cudatext-tabs-multiline.png](/wiki-images/4/41/cudatext-tabs-multiline.png)](</File:cudatext-tabs-multiline.png>)
2262+
2263+ * Tabs can have fixed or variable width. "Variable width" means that tabs are auto-stretched to fit the longer title. Option "ui_tab_variable_width". Minimal/maximal width of fixed tabs is customizable.
2264+
2265+ * Tabs can be shaped/bordered, or can be flat. Option "ui_tab_flat". Flat tabs are painted with additional colored underline for the active document.
2266+
2267+[![cudatext-tabs-flat.png](/wiki-images/9/92/cudatext-tabs-flat.png)](</File:cudatext-tabs-flat.png>)
2268+
2269+ * Tabs can be dragged by mouse: inside original group or to another groups (to show another groups use "Split" top menu item). And can be moved to specified group index using tab context menu items "Move tab to group n".
2270+ * Program can be used without tabs at all. Options "ui_tab_show" and "ui_tab_disabled".
2271+
2272+ * Tabs can be colored, by calling tab's context menu, and "Set tab color..." menu item. Internally, it calls plugin cuda_palette to choose the color, then color is applied. Plugin dialog has several modes (even simplest mode named "60 colors" is enough). By default, only thin line at the edge of tabs is colored, but you can colorize the entire tab using CudaText option "ui_tab_fullcolor". Coloring is saved to session (tab color is usual property of editor).
2273+
2274+[![cudatext-tab-colors.png](/wiki-images/e/ea/cudatext-tab-colors.png)](</File:cudatext-tab-colors.png>)
2275+
2276+ * Tabs can have file-type icons, if plugin "Tab Icons" is installed (icons are preinstalled already, they are used by Project Manager). Plugin also allows to assign icons from additional set of 16x16 PNG files.
2277+
2278+[![cudatext-tab-icons.png](/wiki-images/9/98/cudatext-tab-icons.png)](</File:cudatext-tab-icons.png>)
2279+
2280+ * Tabs can show "path suffix" when there are several tabs for the same base filename. In the example picture, we have opened files "t.txt" from 3 different folders, and tabs show that folders after a bullet-char. Feature can show "path suffix" for up to 4 folder levels.
2281+
2282+[![cudatext-tabs-path-suffix.png](/wiki-images/f/f1/cudatext-tabs-path-suffix.png)](</File:cudatext-tabs-path-suffix.png>)
2283+
2284+ * When too many tabs are opened, so that they don't fit by width/height:
2285+ * the left/right "arrow" icons become working, they scroll the tabs-control;
2286+ * the reddish "scroll marker" appears at the edge of the tab-control. Picture shows 2 windows with the scroll marker: one with single-line tabs, another is with multi-line tabs.
2287+
2288+[![cudatext-tabs-red-marker.png](/wiki-images/c/cc/cudatext-tabs-red-marker.png)](</File:cudatext-tabs-red-marker.png>)
2289+
2290+ * Tabs can be made "pinned" using tab's context menu item "Pinned". Pinned tab caption renders with a "!" prefix char. Commands "Close all tabs" and "Close other tabs" skip pinned tabs. Closing of a pinned tab shows additional confirmation like "Tab is pinned... Are you sure you want to close it?".
2291+
2292+# Activating internet links
2293+
2294+CudaText allows to activate internet links (URLs) and e-mails (e-mail can be with the '[mailto:'](<mailto:'>) and without it). This feature needs that links are automatically underlined in the editor. After the double-click on an underlined link, editor shows small button over the link (button with caption "Open link" or "Send e-mail"), and clicking on this temporary button activates the link.
2295+
2296+[![cudatext-click-link.png](/wiki-images/2/2e/cudatext-click-link.png)](</File:cudatext-click-link.png>)
2297+
2298+This works with the default values of 2 options:
2299+
2300+ * "links_regex": it must include RegEx, which detects and underlines links
2301+ * "mouse_click_links": it gives choices:
2302+ * don't activate links by clicks
2303+ * activate by single click
2304+ * activate by double click
2305+
2306+# HTML color codes underlining
2307+
2308+CudaText can colorize HTML color codes, which have these forms:
2309+
2310+ * #abc
2311+ * #abc0
2312+ * #aabbcc
2313+ * #aabbcc00
2314+ * rgb(100, 200, 100)
2315+ * rgba(100, 200, 100, 0.5)
2316+ * hsl(0, 100%, 50%)
2317+ * hsla(0, 100%, 50%, 0.5)
2318+
2319+Two options configure this feature:
2320+
2321+ * "underline_color_files": Specifies which file extensions are supported by the feature.
2322+ * "underline_color_size": Specifies the size of colored block in the editor area. It can be simple underline below the color code, or a background highlighting. Background highlighting can be in 2 variants: for entire text, for the fragment inside brackets.
2323+
2324+Screenshot shows all 3 variants in different CudaText windows:
2325+
2326+[![cudatext-color-underline.png](/wiki-images/1/1a/cudatext-color-underline.png)](</File:cudatext-color-underline.png>)
2327+
2328+# UI scaling
2329+
2330+UI can be scaled by these options:
2331+
2332+ * "ui_scale" (needs suffix for OS): it scales the sizes of UI controls only.
2333+ * "ui_scale_font" (needs suffix for OS): it scales fonts sizes only (both editor text font and UI font).
2334+
2335+Auto-detection of current OS scale is implemented for Windows only. And you can ignore the Windows scale auto-detection, by setting the above options.
2336+
2337+Additional options are:
2338+
2339+ * "ui_tab_scale": it scales UI-tabs font, independent from other options.
2340+ * "minimap_scale": it scales minimap only, independant from other options.
2341+ * "unprinted_symbols_scale": it scales graphics rendered for non-printable stuff: spaces, tabs, EOL text markers.
2342+
2343+If you scale UI, you may want to scale the icons as well. But icons are PNG images and cannot be resized, so the solution here is additional icon sets. In the menu "Plugins / Addons Manager / Install" you will find several categories of icon sets:
2344+
2345+ * category "sidebartheme" - configured by option "ui_sidebar_theme"
2346+ * category "toolbartheme" - configured by option "ui_toolbar_theme"
2347+ * category "codetreeicons" - configured by option "ui_tree_theme"
2348+ * category "projtoolbaricons" - configured by dialog of Project Manager
2349+ * category "filetypeicons" - configured by dialog of Project Manager
2350+
2351+# Themed top menu
2352+
2353+Top menu (together with some context menus and menu from the "hamburger" icon) can be themed. Only on Windows. This needs the option `"ui_menu_themed":true` (it's 'true' by default). When option is on, menu font/background/selection/checkmarks become colored from other CudaText UI theme colors. Also, option "ui_menu_themed_font_size" allows to change the font size.
2354+
2355+You can also set colors of menu elements directly; dialog "Options / Themes / Settings - theme - ui" provides theme items for this. For example, to set the font-color of the top menu, change the color of element "top menu, font" in the dialog.
2356+
2357+[![cudatext-menu-colorsetup.png](/wiki-images/d/dd/cudatext-menu-colorsetup.png)](</File:cudatext-menu-colorsetup.png>)
2358+
2359+By default, elements "top menu, ...." in the dialog have the "none" color (crossed rectangles), it means that actual colors are taken from other UI-theme elements:
2360+
2361+ * "top menu, font" - falls back to element "tabs, font"
2362+ * "top menu, font, hotkey" - falls back to element "top menu, font" and then to element "tabs, font, modified tab"
2363+ * "top menu, font, disabled state" - falls back to element "tabs, passive tab border"
2364+ * "top menu, BG" - falls back to element "tabs, active tab BG"
2365+ * "top menu, BG, selected" - falls back to element "tabs, mouse-over tab BG"
2366+
2367+# Margins
2368+
2369+CudaText gives 2 options to render vertical lines in specified columns:
2370+
2371+ * "margin": Integer value, column of "normal margin" vertical line. This margin is used also by the word-wrapping, then "wrap_mode" option is 2 or 3. It is also used by CudaExt plugin's action(s) ("Re-wrap lines by margin").
2372+ * "margin_string": String of space-separated numbers, it makes vertical lines appear at additional columns.
2373+
2374+The plugin "Column Marks" adds more features:
2375+
2376+ * Commands to set the "normal margin" and/or "additional margins" via prompt dialog. Plugin can save entered value to the user.json config.
2377+ * Commands to move the caret though all margin columns (normal + additional), to the left/right.
2378+
2379+# Add-ons
2380+
2381+## How to disable plugins
2382+
2383+If file "plugin_disabled" (contents is ignored) exists in the plugin's folder (near install.inf), then plugin will be ignored.
2384+
2385+## Entire plugins list
2386+
2387+See the [GitHub repository](<https://github.com/halfbrained/cudatext_plugins_list>) with the readme and links about almost all published plugins. You can make Pull-Request there, if needed.
2388+
2389+## Kinds of add-ons
2390+
2391+**plugins**
2392+
2393+Extensions with Python code. They add events and/or commands. Commands can be called then via "Plugins" top menu, but only if plugin's install.inf file doesn't hide menu items in "Plugins". In any case, all commands can be called via Command Palette dialog.
2394+
2395+**lexers**
2396+
2397+Syntax highlighting files. For ex, Arduino lexer adds item "Arduino" to the lexer menu. Some addons can add 2 or more lexers, for ex "HTML nnnnnn" addons often add 2 lexers: one is visible in the lexer menu, another one is hidden (it supports embedded blocks).
2398+
2399+**linters**
2400+
2401+Sub-plugins for CudaLint plugin. Each supports some lexer (or several similar lexers). To use them, install CudaLint plugin, open your work file, and call CudaLint commands: it calls appropriate linter and shows colored bookmarks on error/warning lines.
2402+
2403+**formatters**
2404+
2405+Sub-plugins for CudaFormatter plugin. Each supports one or several lexers and can reformat source code for these lexers. Examples: Python ReIndent, JS Sort Imports, AStyle Format.
2406+
2407+**tree helpers**
2408+
2409+Plugins which show Code-Tree structure and/or folding, for some lexers. For the following lexers tree-helpers are built-in (ie written in Pascal): Ini (lite lexer "Ini files ^"), Markdown, MediaWiki, reStructuredText, WikidPad, Textile.
2410+
2411+**snippets_ct**
2412+
2413+Collections of text fragments, for "Snippets" plugin (which is required to use snippets). See details in the [[CudaText plugins|CudaText_plugins#Snippets]].
2414+
2415+**translations**
2416+
2417+CudaText UI translations. For ex, JP translation changes all menuitems + dialogs to JP language. Dialogs of plugins are not affected.
2418+
2419+**plugintranslation**
2420+
2421+Translation of plugin strings to different languages. This includes translation of strings from Python code, and strings from "install.inf" files.
2422+
2423+**themes**
2424+
2425+UI/syntax themes for the "Options / Themes / Select color theme..." dialog. "UI" themes change colors of CudaText interface. "Syntax" themes change colors of text in syntax highlighted files.
2426+
2427+**Icons**
2428+
2429+**sidebar themes**
2430+
2431+Icon sets for the sidebar (vertical row of buttons on the left side).
2432+
2433+**toolbar themes**
2434+
2435+Icon sets for the main toolbar (horizontal row of buttons on the top).
2436+
2437+**toolbar x icons**
2438+
2439+Icon sets for plugin "Config Toolbar", for user-added buttons.
2440+
2441+**file type icons**
2442+
2443+Icon sets for the file list of "Project Manager" plugin. Usually these are repackaged icons for VS Code editor.
2444+
2445+**proj toolbar icons**
2446+
2447+Icon sets for the toolbar of "Project Manager" plugin.
2448+
2449+**code-tree icons**
2450+
2451+Icon sets for the Code-Tree (icons are visible in the Code-Tree with some lexers, e.g. C#).
2452+
2453+**build systems**
2454+
2455+Configuration files for different external tools, for the Runner plugin. Runner plugin supports build-systems for Sublime Text 3 (only JSON configs, without support for additional Python codes).
2456+
2457+**packages**
2458+
2459+Packages with possible binary files, which will be unpacked to the CudaText installation folder. For the date 2021.08, these are only Python engines, for CudaText Windows build.
23712460
23722461## How to install add-ons offline
23732462
23742463Usually users install add-ons online, using "Plugins / Addons Manager / Install" command. But for some users online method is not available. How to install add-ons offline:
23752464
23762465 * Download all add-ons in one zip file from this SourceForge page: <https://sourceforge.net/projects/cudatext/files/addons_all/> . Unpack this zip file to some folder.
23772466 * You will find there individual add-ons, like "plugin.xxxx.zip", "lexer.yyyy.zip", "linter.zzzz.zip" etc.
23782467 * To install individual add-on, just open its zip file in CudaText "File / Open file" dialog. CudaText will handle zip archive and suggest to install add-on from it.
23792468
23802469# Color themes
23812470
23822471## Color themes introduction
23832472
23842473There are two kinds of themes:
23852474
23862475 * UI themes, file extension .cuda-theme-ui
23872476 * Syntax themes, file extension .cuda-theme-syntax
23882477
238924782 dialogs allow to customize these 2 kinds of themes:
23902479
23912480 * "Options / Themes / Settings - theme - ui..."
23922481 * "Options / Themes / Settings - theme - syntax..."
23932482
23942483And 3rd dialog allows to switch the currently active theme:
23952484
23962485 * "Options / Themes / Select color theme..."
23972486
23982487How to use customization dialogs, steps:
23992488
24002489 * Call dialog: "Options / Themes / Settings - theme - xxxx..."
24012490 * For UI themes: customize colors in dialog
24022491 * For syntax themes: customize lexer-styles in dialog
24032492 * For syntax themes: test theme at least on JavaScript/HTML/CSS/C/Pascal/Ini/Markdown lexers. On what files to test:
24042493 * You can use sample codes in the "Options / Lexers / Lexer properties" dialog.
24052494 * You can use sample files from <https://github.com/Alexey-T/lexer_tests/tree/master/test_CudaText_color_themes>
24062495 * New theme files are saved in the subfolder "data/themes"
24072496
24082497Don't configure custom lexer styles in the "Options / Lexers / Lexer properties" dialog, if option "ui_lexer_themes" is on (usually it's on), because syntax-theme will override all your colors from that dialog. You can configure colors there, if option is off.
24092498
24102499## UI theme items with none-values
24112500
24122501The following UI theme items allow "none" values, it means that JSON theme-file stores the empty string for them, and plugin API returns COLOR_NONE value for them.
24132502
24142503 * EdCurLineBg2 / 'editor, current line BG': when "none", it falls back to EdCurLineBg
24152504 * EdBlockStapleActive / 'editor, block staples, for caret': when "none", it falls back to EdBlockStaple
24162505 * OtherTextFont / 'single-line inputs, font': when "none", it falls back to EdTextFont
24172506 * OtherTextBg / 'single-line inputs, BG': when "none", it falls back to EdTextBg
24182507 * TabFontActive / 'tabs, font, active tab': when "none", it falls back to TabFont
24192508 * TabCloseBg / 'tabs, close button BG': when "none", X-icon background is not painted
24202509 * StatusFont / 'statusbar, font': when "none", it falls back to ButtonFont
24212510 * StatusBg / 'statusbar, BG': when "none", it falls back to TabBg
24222511
24232512And the following items, which colorize the main menu - they are used only on Windows:
24242513
24252514 * MenuFont / 'top menu, font': when "none", it falls back to TabFont
24262515 * MenuFontHotkey / 'top menu, font, hotkey': when "none", it falls back to MenuFont, then to TabFontMod
24272516 * MenuFontDisabled / 'top menu, font, disabled state': when "none", it falls back to TabBorderPassive
24282517 * MenuBg / 'top menu, BG': when "none", it falls back to TabBg
24292518 * MenuSelBg / 'top menu, BG, selected': when "none", it falls back to TabOver
24302519
24312520## How to create theme package
24322521
24332522 * If your theme files need some sort of 'suffix' (e.g. "dark", "light", "alternative"), put these suffixes into round brackets, after space-char, in the filename. For example, name the file "brackets (dark).cuda-theme-ui" instead of "brackets-dark.cuda-theme-ui". This is required by Addons Manager plugin, which will need to find the add-on package for your theme.
24342523
24352524 * Create such file "install.inf" in UTF-8 encoding (without BOM):
24362525
24372526```
24382527[info]
24392528 title=MyName UI theme (by AuthorName)
24402529 type=cudatext-data
24412530 subdir=themes
24422531 homepage=https://github.com/nnnn/pppp
24432532```
24442533
24452534 * Make zip file "theme.MyName.zip" with files "MyTheme.cuda-theme-nnnnn" and "install.inf".
24462535 * Test zip file: open zip file in CudaText, confirm installation.
24472536 * Publish file at forum or <https://github.com/Alexey-T/CudaText/issues>
24482537
24492538## Meaning of UI-theme elements
24502539
24512540 * "editor, font" - Color of editor font, when no lexer is active. To deactivate lexer in current editor ui-tab: click statusbar cell with lexer name, call item "(none)" in the menu.
24522541
24532542 * "editor, disabled state, font/BG" - Editor is shown as disabled when Replace dialog runs 'Replace all' action, with option "Confirm on replace" (when the confirmation message is shown, editor is disabled). Too see the "..., font" color applied, deactivate the editor lexer.
24542543
24552544 * "editor, current line BG, other wrapped parts" - Color is used for long wrapped lines, when options `"show_cur_line":true` and `"show_cur_line_minimal":false`. Color is used for background of non-current wrapped line parts, belonging to the caret's line. By default color is 'none', so program falls back to "current line BG" for other wrapped parts.
24562545
24572546 * "editor, horizontal folding line" - This line is painted below the folded block, when option `"fold_style":4`, and you fold (collapse) some folding-range (with some lexer active).
24582547
24592548 * "editor, marked range BG" - Color is shown for marked range. To set marked range e.g. from line 5 to 10, enter in the Console:
24602549```
24612550ed.set_prop(PROP_MARKED_RANGE, '5,10')
24622551```
24632552
24642553.
24652554
24662555 * "editor, markers" - Color of "markers" feature. To see markers, call Command Palette's command "drop marker at caret".
24672556
24682557 * "editor, minimap, tooltip border" - Border rectangle, painted over a) tooltip which is shown for mouse-over-folded-block with option `"fold_tooltip_show":true`, b) tooltip which is shown for mouse-over-minimap with option `"minimap_tooltip_show":true`.
24692558
24702559 * "editor, wrapped line indent vert-lines" - Vertical line is painted on the left side of the wrapped part, if you have long wrapped line, and this line begins with e.g. 10 spaces.
24712560
24722561 * "statusbar alt" - Color is used on alternative statusbar. Too see this statusbar, enter in the Console input field:
24732562```
24742563msg_status_alt('d'*100, 8)
24752564```
24762565
24772566.
24782567
24792568 * "search progressbar" - To see it, call Replace dialog, with RegEx option on, with Confirmation option on (2 options in the Replace dialog), and do the mass replacement of RegEx "." with "www".
24802569
24812570 * "side-toolbar, button badges font/BG" - Color of text badges. To see a badge on sidebar, write to Console input field:
24822571```
24832572print("ERROR: aaa")
24842573```
24852574
24862575. The line "ERROR: aaa" will appear in the Console log, and sidebar will show badge "1", meaning you have 1 error line.
24872576
24882577 * "listbox, ..." - Colors of Command Palette dialog, Go To dialog, and similar menu-like dialogs.
24892578
24902579 * "listbox, ..., auto-complete..." - Colors of auto-completion listbox. To see the auto-completion listbox, activate e.g. Pascal lexer, write the incomplete word "Wr" and press Ctrl+Space to call auto-completion. Listbox has 3 columns, 3rd column is shown not for all items.
24912580
24922581 * "splitters, main" - Color is shown on (vertical) splitter near sidebar and above (horizontal) splitter near bottom panel.
24932582
24942583 * "splitters, groups" - Color is shown on splitters between groups (vertical and horizontal). To see these splitters, activate e.g. 2 or 3 groups using "Split" top menu item.
24952584
24962585## Meaning of syntax-theme elements
24972586
24982587 * Id: Normal id (identifier) or text.
24992588 * Id1: Used for various id kinds, e.g. when id has mixed-casing like "SomeClassName".
25002589 * Id2: Used for standard type names like "int"/"bool"/"float" and sometimes for constants like "true"/"false"/"null".
25012590 * Id3: Used for CSS measurement units like "px" and class/function modifiers like "public"/"private".
25022591 * Id4: Used not often, for some special kinds of identifiers.
25032592 * IdKeyword: Used for syntax keywords like "for"/"if"/"class".
25042593 * IdVar: Variables, e.g. "$name" in PHP and Bash.
25052594 * IdBad: Incorrect/misslepped id.
25062595 * String: String literals.
25072596 * String2: String literals, used e.g. for RegEx constants.
25082597 * String3: String literals, one more kind, rarely used.
25092598 * Symbol: Non-word symbols, ie brackets/punctuation/operators.
25102599 * Symbol2: Non-word symbols, used when syntax needs another style for e.g. assignment/math operators.
25112600 * SymbolBad: Incorrect non-word symbols.
25122601 * Comment: Comments.
25132602 * Comment2: Comments, used when syntax needs another style of comments, e.g. shebang in Bash.
25142603 * CommentDoc: Documentation comments, ie comments which are parsed by special tools.
25152604 * Number: Numbers: decimal, hex, octal, binary, floating point.
25162605 * Label: Used e.g. in Python for function/class names after "def"/"class". Used for "GoTo labels" if a language supports such a thing.
25172606 * Color: Color constants, like #RRGGBB in HTML/CSS.
25182607 * IncludeBG#, SectionBG#: Styles which have background color set, and foreground color unset (none). Used to highlight function blocks, sub-lexer blocks, parts of a file, etc.
25192608 * BracketBG: Style with background+foreground colors. Used to highlight paired brackets, begin/end keywords, repeat/until keywords (when "dynamic highlighting" option is on) etc.
25202609 * CurBlockBG: Style with background color set, foreground color unset. Used to highlight block under caret, when "dynamic highlighting" option is on.
25212610 * SeparLine: Frame color for Find/Replace dialog's "Highlight all" ("Hi") results.
25222611 * TagBound: HTML tags: angled brackets.
25232612 * TagId: HTML tags: tag names.
25242613 * TagIdBad: HTML tags: incorrect tag names.
25252614 * TagProp: HTML tags: properties/attributes of tags, before "=" char.
25262615 * TagPropBad: HTML tags: incorrect props/attributes of tags.
25272616 * TagInclude: Tags used for inclusion of sub-lexer blocks. Used e.g. in PHP, <? ?>.
25282617 * LightBG#: Styles with bright background color, and normal foreground. Used e.g. in Diff to highlight deleted (LightBG1) / changed (LightBG2) / added (LightBG3) text blocks. Also used by Git_Status plugin to mark "Git changed" lines on the editor gutter.
25292618
25302619# Tech topics
25312620
25322621## Encoding detection
25332622
25342623Encoding detection works by this pseudo-code:
25352624```
25362625// Corresponding source code is in repository ATSynEdit, file atstrings_load.inc,
25372626 // procedure DoDetectStreamEncoding and
25382627 // procedure TATStrings.DoLoadFromStream
25392628
25402629 if file_has_signature(UTF8) then
25412630 return(UTF8)
25422631
25432632 if file_has_signature(UTF32_LE) then
25442633 return(UTF32_LE)
25452634
25462635 if file_has_signature(UTF32_BE) then
25472636 return(UTF32_BE)
25482637
25492638 if file_has_signature(UTF16_LE) then
25502639 return(UTF16_LE)
25512640
25522641 if file_has_signature(UTF16_BE) then
25532642 return(UTF16_BE)
25542643
25552644 if file_size > 50M then
25562645 return(UTF8)
25572646
25582647 if encoding_saved_to_history_file(enc) then
25592648 // function changes the "enc" param
25602649 return(enc)
25612650
25622651 enc = UTF8
25632652
25642653 detect = file_detect_utf8_content
25652654 // it can get 3 values:
25662655 // UTF8_ASCII: only ASCII chars present
25672656 // UTF8_OK: correct UTF8, non-ASCII, chars present
25682657 // UTF8_BROKEN: broken UTF8 chars present
25692658 if detect == UTF8_OK then
25702659 return(UTF8)
25712660 if detect == UTF8_BROKEN then
25722661 enc = fallback_encoding // from option "fallback_encoding"
25732662
25742663 if file_detect_by_python_standard(detect) then
25752664 // it returns detected encoding in "detect" param
25762665 return(detect)
25772666
25782667 if file_detect_by_xml_signature(detect) then
25792668 // it returns detected encoding in "detect" param
25802669 return(detect)
25812670
25822671 if file_detect_utf16_content(detect) then
25832672 // it returns detected encoding in "detect" param
25842673 return(detect)
25852674
25862675 return(enc)
25872676```
25882677
25892678UTF-8 content detection works by first 8K of file. UTF-16 content detection works by first 5K of file. If encoding was detected as UTF8, the file loader checks the content again (the entire file size now) for UTF8 chars correctness, and if it finds "not correct UTF8 chars", encoding will be changed to ANSI.
25902679
25912680ANSI maps to one of real codepages, it depends on current Windows locale. On non-Windows OS, ANSI maps to cp1252.
25922681
25932682What is "file_detect_by_python_standard"? It is detection [by this standard](<https://docs.python.org/3/reference/lexical_analysis.html#encoding-declarations>). Encoding name is searched by RegEx in the first 1-2 lines of file, if they are comment lines. Comments of these kinds are supported: // # ; --. For simplicity, comment chars are skipped, ignoring current lexer, so it works for all files and all lexers.
25942683
25952684What is "file_detect_by_xml_signature"? It is detection by signature, in the first file line, like this:
25962685```
25972686<?xml version="1.0" encoding="ISO-8859-9"?>
25982687```
25992688
26002689## Reduced functionality for big files
26012690
26022691CudaText has the following optimizations for big files and huge lines:
26032692
26042693 * CudaText refuses to load files >500Mb. See the option `"ui_max_size_open":500` (in Mbytes). Program allows to open such files in built-in viewer (without editing).
26052694
26062695 * Word-wrap mode is automatically turned off, when total lines count in document is huge. See the option `"wrap_enabled_max_lines":60000`. When word-wrap mode is off, editor's work is much faster.
26072696
26082697 * Program refuses to activate "normal" lexer for big files >2Mb. See the option `"ui_max_size_lexer":2` (in Mbytes). Note that "lite" lexers with suffix "^" are still enabled for big files.
26092698
26102699 * If file is loaded in "normal" lexer, but count of lines is big, program disables finding of fold-ranges. Syntax coloring works, but folding doesn't work. See the option `"lexer_folding_max_lines"`.
26112700
26122701 * If file is loaded in "normal" lexer, dynamic highlightings are disabled in big files. See the option `"dynamic_highlight"`.
26132702
26142703 * For any files, when too many multi-carets are placed, program disables/clears the Undo-information for editing. See the option `"undo_max_carets"`.
26152704
26162705## CJK text is rendered bad on huge lines
26172706
26182707[![cudatext-cjk-len1024.png](/wiki-images/a/ab/cudatext-cjk-len1024.png)](</File:cudatext-cjk-len1024.png>)
26192708
26202709On lines longer than 4K chars, CJK text is rendered not nicely - full-width chars are rendered as half-width chars, so they overlap. This is internal limitation of CudaText. There is no option for this. This is limitation for non-wrapped lines. When you turn word-wrap on, all wrapped parts will be rendered correctly.
26212710
26222711Maximal length of this limit can be changed in the source code. Find this line in the file "atsynedit/atsynedit/atstringproc.pas":
26232712```
26242713ATEditorMaxFixedArray = 4*1024;
26252714```
26262715
26272716## How to open files in a new window instead of a new tab
26282717
26292718Option "ui_one_instance" controls it, so change it to 'false' (without quotes, in "user.json"). This option is here for several years already, but people are asking this question again and again (forum, GitHub, Linux sites). Seems the term "instance" is not known very good, people cannot find this option easily.
26302719
26312720## How to compile CudaText
26322721
26332722First, install FPC and Lazarus:
26342723
26352724 * [download FpcUpDeluxe](<https://github.com/newpascal/fpcupdeluxe/releases>). On Windows, you must unlock .exe file in the Windows Explorer dialog.
26362725 * in FpcUpDeluxe, choose FPC last release, install it first.
26372726 * in FpcUpDeluxe, choose Lazarus (last release or Git 'main'), install it next.
26382727
26392728**Classic way to compile**
26402729
26412730 * download GitHub repos:
26422731 * <https://github.com/bgrabitmap/bgrabitmap> (install first)
26432732 * <https://github.com/Alexey-T/Python-for-Lazarus>
26442733 * <https://github.com/Alexey-T/ATFlatControls>
26452734 * <https://github.com/Alexey-T/EncConv>
26462735 * <https://github.com/Alexey-T/ATSynEdit> (install after ATFlatControls and EncConv)
26472736 * <https://github.com/Alexey-T/EControl> (install after ATSynEdit)
26482737 * <https://github.com/Alexey-T/ATSynEdit_Ex> (install after EControl)
26492738 * <https://github.com/Alexey-T/ATSynEdit_Cmp>
26502739 * <https://github.com/Alexey-T/ATBinHex-Lazarus>
26512740 * <https://github.com/Alexey-T/Emmet-Pascal>
26522741 * <https://github.com/Alexey-T/CudaText> (no package here, only project)
26532742
26542743 * install .lpk packages into Lazarus (find all .lpk files, open them in IDE, install from Packages dialog)
26552744 * in the Lazarus component palette, you should see:
26562745 * "AT Controls" tab: TATButton, TATButtonsToolbar, TATListbox, TATScroll, TATSynEdit, TATLabelLink, TATGauge
26572746 * "Python" tab: several items
26582747 * in Lazarus, open "cudatext.lpi" project, compile it
26592748
26602749**CudaText_up way to compile**
26612750
26622751There is [Linux script CudaText_up](<https://github.com/Alexey-T/CudaText_up>) \- it downloads sources to ~/cudatext_up, then calls Lazarus to compile them. You can use it with FPC cross-compilers, installed from FpcUpDeluxe, script will compile CudaText for any of available platforms. Without cross-compilers, script makes CudaText only for the current platform. It puts result to ~/cudatext_up/bin.
26632752
26642753### Linux error on ATSynEdit compiling
26652754
26662755You may get this error:
26672756```
26682757atsynedit_adapter_gtk2ime.pas(131,5) Error: (5000) Identifier not found "IM_Context_Set_Cursor_Pos"
26692758```
26702759
26712760To avoid this error, open IDE dialog "Tools / Configure 'Build Lazarus'", and there enable the define:
26722761```
26732762WITH_GTK2_IM
26742763```
26752764
26762765To enable the define, press the "Edit Defines" button in the dialog, small memo-dialog will open. Write there "WITH_GTK2_IM", press OK, word will appear in the "Configure 'Build Lazarus'" dialog. Place the checkmark near this word. After enabling the define, recompile the IDE: "Tools / Build Lazarus with profile".
26772766
26782767[![Enable these IDE defines](/wiki-images/8/8e/atsynedit_ide_defines.png)](</File:atsynedit_ide_defines.png> "Enable these IDE defines")
26792768
26802769### CudaText_up on Windows
26812770
26822771Few tricks are required to build CudaText via CudaText_up. Retrieve <https://github.com/Alexey-T/CudaText_up> using "git clone". Use Git Bash to run the cudaup.sh:
26832772```
26842773cd /C/Prj/Pas/CudaText_up
26852774 ./cudaup.sh
26862775```
26872776
26882777The command "./cudaup.sh --get" did not succeed from the first attempt, because Git under Windows downloads text files with CRLF line endings, whereas the cudaup.sh expects the files "cudaup.packets" and "cudaup.repos" to have LF line endings. So open these two files in text editor and change the line endings to LF. After that, "./cudaup.sh --get" succeded. Then run
26892778```
26902779./cudaup.sh --lazdir /C/fpcupdeluxe/lazarus --packs
26912780```
26922781
26932782specifying the path where FpcUpDeluxe was previously installed. Finally run
26942783```
26952784./cudaup.sh --lazdir /C/fpcupdeluxe/lazarus --make --os win64
26962785```
26972786
26982787where the part "--os win64" was absolutely essential because without it the project tried to be compiled under Linux (that obviously failed on a Windows machine).
26992788
27002789## How to install plugins from GitHub
27012790
27022791First, you need to know GitHub repository (repo) URL of plugin. For example, <https://github.com/kvichans/cuda_find_in_files> . If you have plugin already, then you can see this URL in the plugin's install.inf (line "homepage=").
27032792
27042793Next, call CudaText menu item "Plugins / Addons Manager / Install from GitHub". Enter URL in the suggested dialog. Addons Manager will install latest version from GitHub. Addons Manager supports all branch names ("master", "main" and others), it will show menu of branch names if there are several branches in the repo. The repo must have correct file "install.inf" in the root, otherwise Addons Manager may not detect the plugin in the repo.
27052794
27062795After you entered the URL, Addons Manager shows messagebox:
27072796```
27082797GitHub repository can be cloned (using "git clone") or can be downloaded as zip file. If you clone, Addon Manager's Update dialog will update add-on using "git pull", which is recommended.
27092798 Buttons: Cancel / Download as zip / Clone repo.
27102799```
27112800
27122801Better to choose "Clone repo" here, this will allow to update plugin directly from GitHub. Choosing the "Download as zip" is ok, but you cannot update plugin from GitHub, you can update plugin only from the released versions from SF.net.
27132802
27142803## How to simply install many add-ons
27152804
27162805 * In the dialog "File / Open file", you can multi-select files in list - with Ctrl+click (on Windows) or Shift+arrows.
27172806 * Use command "Plugins / Addons Manager / Download all", which saves all addons zip files to some folder. When done, install many addons from this folder using "File / Open file" multi-selection.
27182807 * There is [this page](<https://sourceforge.net/projects/cudatext/files/addons_all/>) with zipped collection of all addons, but it is updated not often.
27192808
27202809## How to make translation
27212810
27222811Translation template file is in the folder "data/lang". The template file cannot be activated from "Options / Translations". How to prepare the translation zip package:
27232812
27242813 * make the file "nn_NN.ini" (UTF-8 with BOM)
27252814 * use standard locale names in filename, e.g. ru_RU pt_PT ja_JP (this is needed for plugins which use Python translation API)
27262815 * write your contacts in the first commented lines. Comments must begin with ";" at line start. Also you can add other comments.
27272816 * to set accelerator-chars for menus/dialogs, use "&" char (e.g. "Open &file"). If needed "&" char as is, duplicate it as "&&".
27282817 * note: Linux Ubuntu font is about 1.3 times wider, than on Windows
27292818
27302819 * make the file "install.inf" with such text:
27312820
27322821```
27332822[info]
27342823 title=LangName translation (by AuthorName)
27352824 type=cudatext-data
27362825 subdir=lang
27372826```
27382827
27392828 * make the zip file "translation.nn_NN.zip", it must contain files nn_NN.ini, install.inf
27402829 * test this zip file: open it in CudaText via "File / Open", and check it's installed
27412830 * publish this zip file, at CudaText forum or at GitHub issues <https://github.com/Alexey-T/CudaText/issues>
27422831 * if package is OK, it will be at SourceForge downloads, and in Addon Manager
27432832
27442833## How to make translation of Plugins menu
27452834
27462835CudaText supports translation of Plugins menu items. For example, you have plugin with module cuda_nnn, which has "install.inf" with such menu items:
27472836```
27482837[item1]
27492838 ...
27502839 caption=MyPlugin\ItemOne
27512840 ...
27522841 [item2]
27532842 ...
27542843 caption=MyPlugin\SubMenu\ItemTwo
27552844 ...
27562845```
27572846
27582847Then you need to create files like "ru_RU.ini" in the folder "data/langmenu/cuda_nnn". Create folder "langmenu" inside "data" if it's absent. Files must be in UTF-8 no BOM encoding. They must have section "menu". All items in the ini-file are optional.
27592848```
27602849[menu]
27612850 MyPlugin=local name
27622851 ItemOne=local name of item
27632852 ItemTwo=local name of item
27642853 SubMenu=local name of menu
27652854```
27662855
27672856To distribute those translation(s), make zip file like "langmenu.MyPlugin.zip", which must have "install.inf" and folder "cuda_nnn" (you can put more folders, for several plugins, if you want so). "install.inf" contents:
27682857```
27692858[info]
27702859 title=Translation of menu items of MyPlugin
27712860 type=cudatext-data
27722861 subdir=langmenu
27732862```
27742863
27752864Look at example ZIP packages [at SourceForge page](<https://sourceforge.net/projects/cudatext/files/addons/plugintranslation/>).
27762865
27772866## How to copy word under caret to clipboard
27782867
27792868A1: Install "Macros" plugin. In its dialog start recording a macro, and call these commands using "Command Palette":
27802869
27812870 * command "selection: select words at carets"
27822871 * command "clipboard: copy"
27832872 * command "selection: cancel selection"
27842873
27852874Then assign a hotkey to this macro (in the "Command Palette", find your new macro and press F9).
27862875
27872876A2: Plugin "CudaExt" has commands:
27882877
27892878 * plugin: CudaExt: Copy word or [expression] or 'expression' without selection
27902879 * plugin: CudaExt: Replace word or [expression] or 'expression' with clip
27912880
27922881It's good to use these commands with hotkeys Alt+Left and Alt+Right (assign it in the "Command Palette").
27932882
27942883## Linux: In Qt5 version, text is shifting on selection
27952884
27962885Q1: After some typing, the caret get unaligned with the text. It sort of creeps into the text, making it both tricky to read and tricky to edit.
27972886
27982887Q2: When I select text that is inside a string literal (for example), the beginning of the selection gets a space before it, shifting the selected text to the right. As I select more the text continues to squish around.
27992888
28002889A: That's the issue specific to (Linux) Qt5 version. It's fixable by the option "renderer_tweaks__linux", its default value is:
28012890```
28022891"renderer_tweaks__linux": "ws",
28032892```
28042893
28052894Description of this option in the default config:
28062895```
28072896//Value is a string of several chars:
28082897 // if 'w' in value: Use simplified calculation of average character width.
28092898 // On Windows, 'w' is good.
28102899 // On macOS, 'w' is bad.
28112900 // On GTK2, 'w' is not needed.
28122901 // On Qt5, 'w' gives various results, it depends on Desktop Environment.
28132902 // if 'o' in value: Calculate 'offsets' for individual characters, ie use slower API to render.
28142903 // On Windows, 'offsets' don't decrease rendering speed.
28152904 // On macOS, 'offsets' decrease (2x) rendering speed.
28162905 // On GTK2 and Qt5, 'offsets' decrease rendering speed.
28172906```
28182907
28192908Try this:
28202909
28212910 * Remove "w" char from this option, ie
28222911
28232912```
28242913"renderer_tweaks__linux" : "s",
28252914```
28262915
28272916 * Add "o" char to this option, ie
28282917
28292918```
28302919"renderer_tweaks__linux" : "wso",
28312920```
28322921
28332922Do it in the user.json config, of course. Then restart the editor.
28342923
28352924On macOS, changing the option "renderer_tweaks__mac" is usually not needed - default value works good. But in Qt5 version, CudaText cannot detect Desktop Environment settings, so default value is wrong sometimes.
28362925
28372926## Linux: How to reinstall missed files
28382927
28392928Sometimes it's needed to reinstall missed files, e.g. when you have deleted some lexers from "Lexer library" dialog. Simple re-run of .deb installer works, but it will not reinstall deleted data-files. Why? App has copy of its data-files in ~/.config/cudatext (see the topic about location of data+settings dirs). Binary (not deb installer!) makes this copy - only when binary version is not equal to the version stored to settings/packages.ini, "app" section. After you delete that "app" section, and run the binary (not deb installer), binary will refresh files from /usr/share/... to ~/.config/cudatext/...
28402929
28412930## Linux: Difference between gtk2/qt5 versions
28422931
28432932Versions for gtk2/qt5/etc are compiled for different widget-sets, all functions are the same.
28442933
28452934 * Different widget-sets make different look of native UI controls (e.g. buttons - but only native buttons, note that Find/Replace dialog has not native buttons), native scrollbars, native File-Open/Save dialogs.
28462935 * Different widget-sets need different value of "ui_buffered*" option. So one value of "ui_buffered__linux" is OK for gtk2, while may be worse for qt5.
28472936
28482937So far, different widget-sets are supported for Linux only.
28492938
28502939## Linux: Keyboard input problems
28512940
285229411) Keyboard input is duplicated.
28532942
28542943This is known problem, related to some Input Methods (IM) in Linux. To see what is your active IM, open Terminal and enter:
28552944```
28562945echo $GTK_IM_MODULE
28572946```
28582947
28592948Known IMs with problems: scim, xim. To fix: change IM from e.g. "XIM" to "none" in the Language Support settings, then chars should not duplicate.
28602949
286129502) Keyboard input misses accent chars.
28622951
28632952On some systems, national keyboards (e.g. French) may miss entering of accent chars. This can be solved by changing the Input Method (IM) in the system. [See here](<https://forum.endeavouros.com/t/ibus-and-qt-applications/15125>) for example.
28642953
28652954In short:
28662955
28672956 * Install "ibus" package
28682957 * In the OS environment file, set 2 variables (for 2 builds of CudaText, gtk2 and qt5):
28692958 * GTK_IM_MODULE=ibus
28702959 * QT_IM_MODULE=ibus
28712960
28722961## Unix: Program takes 25 seconds to start
28732962
28742963Q1: CudaText takes exactly 25 seconds to start-up. (In fact a few ms more than that). I am sure the problem is at my end, but cannot place it. It is waiting for something and is timing out.
28752964
28762965Q2: On Debian 12 with Mate desktop I got an empty window and it would have content only after I moved the mouse: even if I waited more then 3 minutes without moving the mouse or pressing a key, the content would appear just after moving the mouse.
28772966
28782967A: Setting the following environment variable solves the issue:
28792968```
28802969IBUS_USE_PORTAL="1"
28812970```
28822971
28832972## Unix: Program takes 60 seconds to start
28842973
28852974Q: When I open any Lazarus/GTK2 application, I get a blank window that will timeout after 60 sec and the application will appear then. If I kill this blank window, the application lauches directly and the CRITICAL output resulting from my kill is always the same:
28862975```
28872976(app_name:1299276): Gtk-CRITICAL **: 19:03:24.607: IA__gtk_widget_hide: assertion 'GTK_IS_WIDGET (widget)' failed
28882977 (app_name:1299276): Gtk-CRITICAL **: 19:03:24.607: IA__gtk_widget_destroy: assertion 'GTK_IS_WIDGET (widget)' failed
28892978```
28902979
28912980If I wait for the timeout there is no output and everything works fine. This issue appeared to me when I tried to use CudaText.
28922981
28932982A: Start the application with "-disableaccurateframe" parameter.
28942983
28952984## Linux: Installation
28962985
28972986**.deb package.** To support .deb package installation, program performs copying of its files, from .deb installation folder to the settings folder. Ie, when binary "cudatext" (it can be in any folder, e.g. in /usr/bin) starts, it checks, if "data/lexlib" exists near the binary, and if not, it copies folders "py", "data", "settings_default" from .deb installation folder to "~/.config/cudatext" (default location of settings, it can be changed by command line option). Program does this not always, it reads the "settings/packages.ini", and checks there [app] "ver" value. If value not equals to the binary's hardcoded version, program does that copying. So copying occurs once, after .deb package was upgraded.
28982987
28992988**.xz package.** It is intended that user just unpacks this archive, to subdirectory of home-directory, and then runs binary "cudatext" from there. This is simpler way. But additional way is also possible - you can "install" the program, so that "cudatext" will be runnable from Terminal. The "installation" is:
29002989
29012990 * unpack CudaText .xz archive to some temp folder
29022991 * copy file "cudatext" to /usr/bin
29032992 * copy folders "py", "data", "settings_default" to "~/.config/cudatext"
29042993 * delete mentioned temp folder
29052994
29062995When you run "cudatext" (from /usr/bin), settings folder "~/.config/cudatext/settings" will be created automatically.
29072996
29082997Note, that you must download proper package for the proper architecture (x64, ARM, AArch64) and proper OS. Sometimes users download Solaris package on Linux, so "cudatext" file cannot be run.
29092998
29102999## Linux: Arch Linux packages
29113000
29123001The GTK2 and Qt5 binaries can also be installed via the AUR if you are on an Arch Linux based system:
29133002
29143003 * <https://aur.archlinux.org/packages/cudatext-gtk2-bin/>
29153004 * <https://aur.archlinux.org/packages/cudatext-qt5-bin/>
29163005
29173006## Linux: Qt5 and Qt6 builds
29183007
29193008**Qt5**
29203009
29213010For Linux Qt5 version, library libQt5Pas is required, release 1.2.15 or newer. Get it from [releases on this page](<https://github.com/davidbannon/libqt5pas/releases>).
29223011
29233012Page contains 2 packages: libqt5pas and libqt5pas-dev, you only need first of them (2nd one is required if you want to compile the app).
29243013
29253014In the GutHub page, press the link like "Show all 22 asserts" and there you will see files:
29263015
29273016 * libqt5pas1_2.15-1_amd64.deb - deb package.
29283017 * libqt5pas_1_2_15-1_amd64.tar.gz - compressed .so files. You can put .so files near the binary "cudatext" and run the editor with such command:
29293018
29303019```
29313020LD_LIBRARY_PATH=. ./cudatext
29323021```
29333022
29343023Some package managers have Qt5Pas package. On Ubuntu: "libqt5pas-dev", on Manjaro: "qt5pas". At the end of 2023 year, these packages are outdated. CudaText crashes with them on closing file-save dialog, with error in Terminal:
29353024```
29363025symbol lookup error: /home/user/cudatext/cudatext: undefined symbol: QTimer_singleShot3
29373026```
29383027
29393028**Qt6**
29403029
29413030For Linux Qt6 version, library libQt6Pas is required, release 6.2.2 or newer. Get it from [releases on this page](<https://github.com/davidbannon/libqt6pas/releases>).
29423031
29433032Page contains 2 packages: libqt6pas6 and libqt6pas6-dev, you only need first of them (2nd one is required if you want to compile the app).
29443033
29453034## Linux: Fedora packages
29463035
29473036To install CudaText on Fedora Linux, make sure you have the DNF core plugins installed on your system. Then, run this command:
29483037```
29493038dnf copr enable -y zliced13/YACR
29503039```
29513040
29523041Afterwards, you can finally install CudaText with this command:
29533042```
29543043dnf install -y cudatext
29553044```
29563045
29573046In this command, replace package name "cudatext" with one of available names:
29583047
29593048 * cudatext-gtk2
29603049 * cudatext-gtk2-aarch64
29613050 * cudatext-qt5
29623051 * cudatext-qt5-aarch64
29633052 * cudatext-qt6
29643053 * cudatext (copy of cudatext-qt6)
29653054 * cudatext-aarch64 (copy of cudatext-qt5-aarch64)
29663055
29673056The *.spec files for all of these packages: <https://github.com/kris3713/YACR/tree/master/packages/cudatext>
29683057
29693058## Linux: App cannot run with GLIBC error
29703059
29713060Some Linux distros may show such error:
29723061```
29733062./cudatext: /lib64/libc.so.6: version `GLIBC_2.34' not found (required by ./cudatext)
29743063```
29753064
29763065This is reported for CudaText builds made by author on 2nd PC with newer GLIBC version. If app was compiled with newer GLIBC, OS with older GLIBC cannot run the app.
29773066
29783067To 'fix' this, install FreePascal/Lazarus and compile CudaText from sources on your PC. Better use fpcUpDeluxe tool, which allows 2-clicks installation of FreePascal with Lazarus.
29793068
29803069## FreeBSD: App cannot run
29813070
29823071If you run app in Terminal, you'll see an error about missing .so file. Reason of this error: FreeBSD version was compiled on Linux with different .so files. To fix error, run command in Terminal:
29833072```
29843073$ sudo ln -s /usr/local/lib/libiconv.so.2 /usr/local/lib/libiconv.so.3
29853074```
29863075
29873076## macOS: App cannot run
29883077
29893078There is known issue, when macOS AArch64 version (ie ARM 64-bit version) cannot be run. The following command clears the extended attributes from the bundle, and it can be run:
29903079```
29913080xattr -cr /Applications/CudaText.app/
29923081```
29933082
29943083(Adjust the file path, if you put the application bundle to a different place.)
29953084
29963085Also note, that our application bundle is not digitally signed. So to run it (the first time you do it), you should right-click the application bundle, and choose "Open" menu item, and confirm that you trust the vendor.
29973086
29983087## Can app save files to system directories
29993088
30003089Under Windows OS, app runs XCOPY command to save files to write-protected folders. XCOPY runs with elevated priviledges. Note: to save for example 'hosts' file on Windows 64-bit, you must use 64-bit version of CudaText.
30013090
30023091Under Linux OS (but not under *BSD/Solaris), CudaText can save files even to system write-protected folders. It runs "pkexec" program for this purpose, and "pkexec" shows GUI confirmation to get admin rights. "pkexec" runs "/bin/cp" to copy file from temp folder to the write-protected folder.
30033092
30043093For example, open some file from write-protected folder on Linux. CudaText detects file permissions, so it should open file in read-only mode. Then, from "Command Palette", call "toggle read-only mode". Then you can edit the file. Edit it and save it - CudaText will try to save it via "pkexec".
30053094
30063095## How to select extra symbols by double-click
30073096
30083097Some languages consider special symbols as word-chars. For example, in PHP, "$" symbol is part of a variable name, so double-click should select "$" together with other word-chars. Follow these steps to add extra symbols (e.g. "$") to word-chars.
30093098
30103099 * Open new file-tab, activate your lexer (click the lexer cell in the statusbar).
30113100 * Call menu item "Plugins / Options Editor Lite".
30123101 * In the "Options Editor Lite" dialog:
30133102 * Focus listbox item of the option "nonword_chars", read description about this option in the bottom.
30143103 * Click the combobox field near "Scope", and choose dropdown item "Lexer: LexerName". It is needed for option to go to the lexer-specific config.
30153104 * Edit the value of the option "nonword_chars".
30163105 * Press Enter-key in the input field, to apply the option (lexer-specific option).
30173106 * Close "Options Editor Lite" by "OK" button.
30183107
30193108What does this procedure do? It creates/modifies file "settings/lexer LexerName.json" to be like this:
30203109```
30213110{
30223111 "nonword_chars": "-+*=/\\()[]{}<>\"'.,:;~?!@#%^&|`"
30233112 }
30243113```
30253114
30263115## How to upgrade but keep all the settings
30273116
30283117 * Q: CudaText for Windows. How can I upgrade but keep all the settings the way I have configured them - including themes, icon sets, etc (basic settings I could just copy the settings file over - but I'm not sure what to do for the icons and the rest...)
30293118
30303119 * A: Copy all files from the zip package, overwriting old files. All user settings are located in "settings" (which is absent in the zip package) and "data" (in different files). If you did not modify CudaText preinstalled files, you will not loose any settings.
30313120
30323121## How to customize top menu and context menu
30333122
30343123See the page [[CudaText plugins|CudaText_plugins#Configure_Menu]].
30353124
30363125## How to help the author to reproduce a bug
30373126
30383127Bugs are often cannot be reproduced on author's PC because of different "user config", "lexer-specific configs", plugins configs. To help the author, make the ZIP file with CudaText folder, add your test file(s) there too, and send this ZIP to e-mail support(@)uvviewsoft.com .
30393128
30403129What CudaText folder to pack?
30413130
30423131 * On Windows: the folder where you copied the program. Exclude files EXE DLL PYD ZIP from ZIP.
30433132 * On macOS: ~/Library/Application Support/CudaText.
30443133 * On Linux, other Unixes: ~/.config/cudatext, or $XDG_CONFIG_HOME/cudatext if this OS variable is set.
30453134
30463135Make the bug reproducible on your CudaText folder on your test file(s). Put your test file(s) in ZIP too. If needed to reproduce the bug, create the session using Session Manager plugin (bug may be visible only with some session). Put session file in ZIP too (usually it's already in the "settings" subfolder).
30473136
30483137## Behaviour of column selection
30493138
30503139CudaText gives two modes of column selection, which have differences when you select over wrapped lines, or lines with full-width characters. This is controlled by the option "carets_primitive_column_sel".
30513140
30523141 * Value "true": "pritimive mode" which behaves much like Sublime Text. In this mode editor places multi-selections over visual rectangle of characters. In this mode, one line can have 6 chars selected, and another line can have 8 chars selected. This depends on visual positions of chars in those lines.
30533142
30543143 * Value "false": in this mode, all affected lines have the same number of selected chars. But when full-width chars (e.g. CJK) are present in text, selection may look weird. Here is an example picture where starting lines are ASCII and ending lines have full-width chars.
30553144
30563145[![cudatext-column-sel-cjk.png](/wiki-images/d/d5/cudatext-column-sel-cjk.png)](</File:cudatext-column-sel-cjk.png>)
30573146
30583147It is not a bug. In this example, user selected column block from column 7 (at line 1) until column 20 (at line 6), so column block takes columns 7...20 from all lines. On first ASCII lines, columns 7...20 take different visual area, than columns on last lines. When you copy/paste that block to another program, block may look differently. But that block contains equal number of chars on each line.
30593148
30603149Even more weird look happens when user selects column block over word-wrapped lines.
30613150
30623151[![cudatext-column-sel-weird.png](/wiki-images/5/52/cudatext-column-sel-weird.png)](</File:cudatext-column-sel-weird.png>)
30633152
30643153Here is the program's logic in all these cases (with full-width characters and with word-wrapped lines). Program calculates (line1, column1) text position of column block left-top edge. Then program calculates (line2, column2) text position of column block right-bottom edge. Then program selects characters in range column1...column2 in all those affected lines line1...line2. And this program logic produces so weird look in word-wrapped mode.
30653154
30663155## How to replace from/to text containing line-breaks
30673156
30683157There are several ways to perform it:
30693158
307031591\. The simplest way: set multi-line mode in the Find/Replace dialog, using "+" button. Input fields will become tall and multi-line. To enter line-breaks there, press Ctrl+Enter.
30713160
307231612\. Use plugin CudaExt:
30733162
30743163 * Select fragment in editor (can contain line-breaks), "what to replace" .
30753164 * Copy to clipboard the fragment (can contain line-breaks), which will be "replacement".
30763165 * Call command in CudaExt plugin: "Replace all occurrences of selected string with clipbrd".
30773166
307831673\. Search for selected editor text (can contain line-breaks) using command "find current selection, next".
30793168
308031694\. Copy fragment (can contain line-breaks) which you need to find, to clipboard. Call command in CudaExt plugin: "Find clipbrd: next".
30813170
30823171## How to create macros and call them via toolbar
30833172
30843173Q: I've used Boxer Editor for over a decade. Its strength is you can create macros that can be assigned to buttons that you can place onto the toolbar. I don’t know of any other text editors that can do that. ?
30853174
30863175This can be done in CudaText like this:
30873176
30883177 * Install plugin "Macros". Restart CudaText.
30893178 * Use new menu "Macros" in the top menu, to record some macro(s). This will create command(s) "plugin: Macros: ..." in the Command Palette.
30903179 * Install plugin "Config Toolbar".
30913180 * Call config dialog via "Plugins / Config Toolbar / Configure buttons". In that dialog, add a button. In the button properties, choose your recorded macro command ("Choose command" button). This will add toolbar button for your macro. Customize this button as you wish (any icon, caption, tooltip).
30923181
30933182## How command "Paste and indent" works
30943183
30953184Command "Edit / Paste and indent" should mimic the Sublime Text command with the same name. How it works? For single line clipboard text, it does the same as usual "Paste". For multi-line clipboard text (let's name it "block"), it aligns all lines of the "block", so that lines 2,3,4,... of the "block" will have the same indentation as the first "block" line. If lines had different indents in the clipboard, **relative indents** will be kept.
30963185
30973186Example: clipboard "block" is:
30983187```
30993188aaaaaaaaaaaaaaaa
31003189 aaaaaaaaaaaaaaaa
31013190 bbbbbbbbbbbbbb
31023191 bbbbbbbbbbbbbb
31033192 cccccccccccc
31043193 cccccccccccc
31053194 dddddddddddddddd
31063195```
31073196
31083197And caret ("|" symbol) is located here:
31093198```
31103199some file text
31113200 some file text
31123201 |
31133202```
31143203
31153204"Paste and indent" with such caret position will give this:
31163205```
31173206some file text
31183207 some file text
31193208 aaaaaaaaaaaaaaaa
31203209 aaaaaaaaaaaaaaaa
31213210 bbbbbbbbbbbbbb
31223211 bbbbbbbbbbbbbb
31233212 cccccccccccc
31243213 cccccccccccc
31253214 dddddddddddddddd
31263215```
31273216
31283217## Why XML document is not fully highlighted by XML lexer
31293218
31303219Sometimes, you can see the poor syntax highlighting in XML documents. It is poorer than the "normal" highlighting in the "Lexer properties" dialog.
31313220
31323221What is the reason? The reason is the blocking option
31333222```
31343223"lexer_folding_max_lines": 10000
31353224```
31363225
31373226You load the big XML document, with line count > 10k, and option blocks the "folding" in this document. It causes the lexer to miss folding ranges, and part of the syntax highlight depends on that (the angled brackets are still highlighted). You need to adjust that option to a bigger value.
31383227
31393228Also note that CudaText has the "lite" lexer "XML ^", which is activated for too big XML files. The blocking option is:
31403229```
31413230"ui_max_size_lexer": 2
31423231```
31433232
31443233With the active "lite" lexer (when statusbar shows "XML ^"), syntax highlight is also not very rich, and there is no folding.
31453234
31463235## How to check the rendering speed
31473236
31483237There is hidden option in user.json:
31493238```
31503239"log_timing": true
31513240```
31523241
31533242It shows the additional label in the editor corner, with red font. Label shows the time of the last rendered frame in milliseconds. Label also shows the counter of rendered frames, so developers can check if editor does redundant repaints. Label also shows 3 moving graphs:
31543243
31553244 * red color: total time of rendering
31563245 * blue color: time spent on TextOut/ExtTextOut Lazarus API
31573246 * green color: time spent on minimap rendering
31583247
31593248For text editing commands (e.g. typing of text), counter may increase by 3 on each command. Why? 3rd repaint is from `"bracket_highlight":true` (occurs in IdleTimer after a small delay), 2nd repaint is from lexer parser - parser makes the repaint when full document is parsed or the current screen is parsed. 1st repaint is the main immediate repaint.
31603249
31613250For caret moving commands, counter may increase by 2 on each command. 2nd repaint is from `"bracket_highlight":true`. 2nd repaint may occur also from the auto-showing of the horizontal scrollbar.
31623251
31633252## How to force file saving to append extension .cfg to filename
31643253
31653254Q: I'm looking for a way for newly created files to be auto-saved with a predefined extension. In my case, it is ".cfg". When I open a new blank tab and then "Save As", I want my file to be saved with a specific extension type, if I write it out in the textbox. As an example, I could write out "Test-File-001.json" and the file would be named like this. If I DON'T specify an extension type I want the file extension to automatically be ".cfg". In this second use-case, I would simply write out "Test-File-001" (without an extension type) and CudaText would save my file as "Test-File-001.cfg".
31663255
31673256A: This can be solved with an fake lexer. Create file "Cfg.lcf" in the folder "data/lexlib" with such contents:
31683257```
31693258object SyntAnal21: TLibSyntAnalyzer
31703259 Extentions = 'cfg'
31713260 LexerName = 'Cfg'
31723261 end
31733262```
31743263
31753264Then set the option in user.json:
31763265```
31773266"newdoc_lexer": "Cfg",
31783267```
31793268
31803269## How to open big files in text viewer, without confirmation dialog
31813270
31823271Q: I want to open too big files (e.g. size bigger than 10Mb) using internal text viewer, without asking each time about it.
31833272
31843273A: Here is primitive plugin. Adjust the size limit in the Python code.
31853274
31863275File `py/cuda_big_to_viewer/install.inf`
31873276```
31883277[info]
31893278 title=Big Files to Viewer
31903279 desc=(Fill the description)
31913280 type=cudatext-plugin
31923281 subdir=cuda_big_to_viewer
31933282 homepage=(Fill the GitHub repo URL)
31943283
31953284 [item1]
31963285 section=events
31973286 events=on_open_pre
31983287```
31993288
32003289File `py/cuda_big_to_viewer/__init__.py`
32013290```
32023291import os
32033292 from cudatext import *
32043293
32053294 BIG_SIZE_IN_MB = 10
32063295
32073296 class Command:
32083297
32093298 def on_open_pre(self, ed_self, filename):
32103299 nsize = os.path.getsize(filename)
32113300 if nsize>=BIG_SIZE_IN_MB*1024*1024:
32123301 file_open(filename, options='/view-text')
32133302 print('Forced viewer for file: '+filename)
32143303 return False
32153304```
32163305
32173306## Windows: Auto-completion doesn't work on Chinese system
32183307
32193308Some users have a problem activating auto-completion by Ctrl+Space (default hotkey) on CJK systems.
32203309
32213310Grok AI knows the reason: The reason Ctrl+Space doesn't trigger auto-completion in CudaText (when editing an HTML file) while Microsoft Pinyin IME is active is a classic and very annoying conflict that's existed in Windows for many years. When the Microsoft Pinyin IME (the default Chinese input method for Simplified Chinese) is active (i.e. the input mode shows Chinese/中), Windows steals the Ctrl+Space keystroke at a very low system level and uses it as the default hotkey to toggle between Chinese and English input modes (中 ↔ 英 / A). This happens before the keystroke ever reaches CudaText → CudaText never sees Ctrl+Space → auto-completion (which uses Ctrl+Space by default) doesn't open.
32223311
32233312**Quick summary — why this happens especially often with Chinese users**
32243313
32253314 * Many editors/IDEs use Ctrl+Space for completion (VS Code, IntelliJ, Eclipse, CudaText, etc.)
32263315 * Microsoft kept Ctrl+Space as default toggle for Chinese IME for historical compatibility.
32273316 * Even if you disable or change the hotkey in Language Settings → Advanced keyboard settings, it often silently reverts or doesn't fully apply (very well-known Windows bug).
32283317
32293318**How to solve it (most reliable methods in 2025–2026)**
32303319
32313320Pick one (usually the first or second works best):
32323321
323333221\. **Best quick fix** — just switch IME to English mode before using completion
32343323
32353324While Microsoft Pinyin is active, press Shift (single press) or Ctrl+Shift → IME switches to English (shows A/英) → Ctrl+Space in CudaText starts working normally again.
32363325
323733262\. **Disable "old version" compatibility mode** (surprisingly fixes it for many people in recent Windows versions)
32383327
32393328Settings → Time & Language → Language & region → Chinese → Options → Microsoft Pinyin → General → Turn OFF the option "Use previous version of Microsoft Pinyin".
32403329
32413330Many users report that this alone makes Ctrl+Space stop being stolen.
32423331
324333323\. **Change or disable the toggle hotkey** (the official way, but often unreliable)
32443333
32453334Settings → Time & Language → Typing → Advanced keyboard settings → Input language hot keys → Change "Between input languages" or "Chinese (Simplified, China) - Microsoft Pinyin" toggle → Set it to something else (e.g. Ctrl+Shift+Z or none) → Log out and log back in (very important — changes usually don't apply immediately).
32463335
32473336## Windows: Substitute another font for missing font characters
32483337
32493338In many fonts, many Unicode characters are missing. This gives problem on Windows 10/11: these characters will be omitted in the rendered result, because CudaText uses GDI rendering system.
32503339
32513340But solution for Windows 10/11 exists. User can specify "fallback" fonts. Run "regedit.exe", navigate to the registry folder:
32523341```
32533342HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontLink\SystemLink
32543343```
32553344
32563345and modify the key there. For example, if you miss CJK chars, and you use font "Consolas", create registry key "Consolas", and set fallback for it:
32573346```
32583347msyh.ttc,Microsoft YaHei UI
32593348```
32603349
32613350This way, when font "Consolas" renders missing words, it fallbacks to "Microsoft Yahei" font.
32623351
32633352Full info about this registry feature: <https://learn.microsoft.com/en-us/globalization/fonts-layout/fonts>
32643353
32653354# Troubleshooting the Windows shell extension for CudaText
32663355
32673356There may be rare cases where CudaText's menu item shows up in Windows Explorer context menu but the entry's icon is missing and an error message states that the provided file name was not found.
32683357
32693358## File sets information
32703359
32713360If you download a 32 bit version of CudaText, you will notice that there are two sets of files belonging to the shell extension.
32723361
32733362Set 1 consists of these files:
32743363
32753364 * CudaText_shell32.dll
32763365 * install_shell32.cmd
32773366 * uninstall_shell32.cmd
32783367
32793368Set 2 consists of these files:
32803369
32813370 * CudaText_shell64.dll
32823371 * install_shell64.cmd
32833372 * uninstall_shell64.cmd
32843373
32853374Since 32 bit versions of CudaText can be run on both 32 bit and 64 bit versions of Windows, two sets of files are needed. Use set 1 if you run CudaText on a 32 bit version and set 2 if you run it on a 64 bit version of Windows.
32863375
32873376The download package of CudaText 64 bit contains only set 2 since this version can only be run on a 64 bit version of Windows.
32883377
32893378**Please note:** It is _not_ possible to install the 32 bit version of the shell extension on 64 bit Windows or vice versa.
32903379
32913380## Common information
32923381
32933382The context menu item works for all types of files, folders, disk drives, desktop links to these items, the desktop background and the background of an Explorer window showing a folder's content. Other kinds of right-clicked items don't show the context menu item.
32943383
32953384The context menu entry's icon is extracted from the file "cudatext.exe", the absence of the icon indicates that "cudatext.exe" wasn't found by the shell extension. That's also the reason for the error message mentioned above.
32963385
32973386## Fixing installation error
32983387
32993388**Please note:** In the following only the 64 bit version of the shell extension running on 64 bit Windows is dealt with. If you want to install the 32 bit shell extension on 32 bit Windows you have to select the appropriate file names.
33003389
33013390In case a suitable item has been right-clicked and the icon is missing from the context menu item, it is possible to install the shell extension manually. To do that please follow the steps below.
33023391
33033392At first ensure that all the files
33043393
33053394 * cudatext.exe
33063395 * CudaText_shell64.dll
33073396 * install_shell64.cmd
33083397 * uninstall_shell64.cmd
33093398
33103399are stored in the same folder.
33113400
33123401Start a Windows console with administrative permissions. If you don't know how to do that search the internet to learn it.
33133402
33143403Use the "CD" command to navigate to the folder where the above files are stored (it should be your CudaText folder). You should end up with a command prompt that looks for example like this:
33153404```
33163405C:\cudatext>
33173406```
33183407
33193408Type the following command into your console window and hit Enter:
33203409```
33213410regsvr32 /u "<Path-to-CudaText-folder>\cudatext_shell64.dll"
33223411```
33233412
33243413This uninstalls the failing shell extension. You should see a confirmation message that indicates a successful deregistration of the DLL.
33253414
33263415Close all programs and log off or restart Windows. Login in again and ensure that the CudaText context menu item has disappeared.
33273416
33283417Start a Windows console with administrative permissions again and use the "CD" command to navigate to your CudaText folder (the folder where the above files are stored).
33293418
33303419Type the following command into your console window and hit Enter:
33313420```
33323421regsvr32 "<Path-to-CudaText-folder>\cudatext_shell64.dll"
33333422```
33343423
33353424You should see a confirmation message that indicates a successful registration of the DLL. Check the Explorer context menu to see if there is a CudaText menu item that has an icon. Right click for example a *.txt file and select "Open with CudaText" from the context menu.
33363425 *[LSP]: Language Server Protocol
33373426 *[PCRE]: Perl Compatible Regular Expressions
33383427 *[ABAP]: Advanced Business Application Programming
33393428 *[Adept]: Automatic Differentiation using Expression Templates
33403429 *[AMPL]: A Mathematical Programming Language
33413430 *[ANTLR]: ANother Tool for Language Recognition
33423431 *[APDL]: Ansys Parametric Design Language
33433432
33443433---
33453434*From the Free Pascal wiki, page "CudaText", as the Internet Archive kept it on 2026-03-22, last changed on 2026-02-21. 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).*

Back to history