### Install Plugin from GitHub using CudaText Addons Manager Source: http://wiki.freepascal.org/CudaText Install plugins by providing their GitHub repository URL to the Addons Manager. Cloning the repository is recommended for easier updates via 'git pull'. The plugin's repository must contain an 'install.inf' file in the root. ```text GitHub 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. Buttons: Cancel / Download as zip / Clone repo. ``` -------------------------------- ### File URI Example Source: http://wiki.freepascal.org/CudaText An example of a file URI format that CudaText can provide auto-completion for. ```uri file://localhost/dir/filename ``` ```uri file:///dir/filename ``` ```uri file:///c:/dir/filename ``` -------------------------------- ### Install CudaText on Fedora Source: http://wiki.freepascal.org/CudaText After enabling the repository, use this command to install CudaText on Fedora Linux. You can replace 'cudatext' with other available package names like 'cudatext-gtk2' or 'cudatext-qt5'. ```bash dnf install -y cudatext ``` -------------------------------- ### HTML Tag Example Source: http://wiki.freepascal.org/CudaText Illustrates the basic structure of an HTML line for auto-completion context. ```html some text ``` -------------------------------- ### Install CudaText Shell Extension Source: http://wiki.freepascal.org/CudaText Register the CudaText shell extension DLL using the 'regsvr32' command in an elevated Windows console. Verify the installation by checking for the CudaText context menu item in Windows Explorer. ```batch regsvr32 "\cudatext_shell64.dll" ``` -------------------------------- ### XML Signature Example Source: http://wiki.freepascal.org/CudaText This example shows the format of an XML declaration that includes encoding information, used for detecting the file's encoding. ```xml ``` -------------------------------- ### HTML File Path Completion Examples Source: http://wiki.freepascal.org/CudaText Demonstrates how CudaText suggests file and folder names within HTML attribute values like HREF or SRC. Completion depends on the partial path provided before the caret. ```html Value "|end" ``` ```html Value "ab|end" ``` ```html Value "bar/foo/|end" ``` ```html Value "../foo/bar/ab|end" ``` -------------------------------- ### Install.inf Configuration for CudaText Theme Package Source: http://wiki.freepascal.org/CudaText This is the content for the install.inf file, which is required for CudaText to recognize and install a UI theme package. Ensure the file is UTF-8 encoded without BOM. ```ini [info] title=MyName UI theme (by AuthorName) type=cudatext-data subdir=themes homepage=https://github.com/nnnn/pppp ``` -------------------------------- ### Configure Line-Based File Detection in user.json Source: http://wiki.freepascal.org/CudaText Map regular expressions matching the start of a file's content to lexer names. Useful for files without standard extensions. ```json { … "detect_line": { "/dev/null ``` -------------------------------- ### Open new CudaText window Source: http://wiki.freepascal.org/CudaText Use the -n flag to ignore the 'ui_one_instance' option and open a new application window. ```bash cudatext -n filename ``` -------------------------------- ### Run CudaText with LD_LIBRARY_PATH Source: http://wiki.freepascal.org/CudaText When using the libqt5pas_1_2_15-1_amd64.tar.gz package, place the .so files near the 'cudatext' binary and run it using this command to set the library path. ```bash LD_LIBRARY_PATH=. ./cudatext ``` -------------------------------- ### Run command plugin on startup Source: http://wiki.freepascal.org/CudaText Use the -c=cuda_module,method_name flag to run a specified command plugin on startup. The plugin is applied only to the active editor tab. Ensure no multiple filenames are passed. ```bash cudatext -c=myplugin,mymethod filename ``` -------------------------------- ### Open File in Viewer via Command Line Source: http://wiki.freepascal.org/CudaText Use command-line arguments to open a file directly in the text, binary, or hex viewer upon CudaText startup. ```bash cudatext -z=text FileName ``` ```bash cudatext -z=binary FileName ``` ```bash cudatext -z=hex FileName ``` -------------------------------- ### Basic CudaText Usage Source: http://wiki.freepascal.org/CudaText Standard command-line syntax for launching CudaText with flags and filenames. ```bash cudatext [ flag … ] filename … ``` -------------------------------- ### Run plugin with parameters Source: http://wiki.freepascal.org/CudaText Use the -p=cuda_module#param1#param2… flag to run a specified plugin and pass parameter strings to its 'on_cli' event. If parameters contain spaces, the entire flag must be double-quoted. ```bash "-p=differ#file1.txt#file2.txt" ``` -------------------------------- ### Read from stdin (Linux only) Source: http://wiki.freepascal.org/CudaText Use the -i flag on Linux to read the contents of stdin into a new document. Example: `ls -l | cudatext -i`. ```bash ls -l | cudatext -i ``` -------------------------------- ### Disable Accurate Frame for Lazarus/GTK2 Applications Source: http://wiki.freepascal.org/CudaText Use the '-disableaccurateframe' parameter when starting Lazarus/GTK2 applications to avoid a 60-second timeout and blank window issue. ```bash (app_name:1299276): Gtk-CRITICAL **: 19:03:24.607: IA__gtk_widget_hide: assertion 'GTK_IS_WIDGET (widget)' failed (app_name:1299276): Gtk-CRITICAL **: 19:03:24.607: IA__gtk_widget_destroy: assertion 'GTK_IS_WIDGET (widget)' failed ``` -------------------------------- ### Typst Lexer Regex for Bash Script Block Start Source: http://wiki.freepascal.org/CudaText This regular expression is used by the Typst lexer to identify the beginning of a Bash script fenced code block. ```regex `{3,}(shell-script|sh|bash|zsh)\b ``` -------------------------------- ### Build CudaText with CudaText_up on Windows Source: http://wiki.freepascal.org/CudaText Use Git Bash to clone the CudaText_up repository and execute the build script. Ensure correct line endings for 'cudaup.packets' and 'cudaup.repos' if encountering errors. Specify the Lazarus directory and target OS for compilation. ```bash cd /C/Prj/Pas/CudaText_up ./cudaup.sh ``` ```bash ./cudaup.sh --get ``` ```bash ./cudaup.sh --lazdir /C/fpcupdeluxe/lazarus --packs ``` ```bash ./cudaup.sh --lazdir /C/fpcupdeluxe/lazarus --make --os win64 ``` -------------------------------- ### Create Translation File for CudaText Source: http://wiki.freepascal.org/CudaText Prepare a translation package by creating an 'nn_NN.ini' file in UTF-8 with BOM encoding. Use standard locale names and include contact information in commented lines. Use '&' for accelerator characters, duplicating it as '&&' for a literal '&'. ```ini [info] title=LangName translation (by AuthorName) type=cudatext-data subdir=lang ``` -------------------------------- ### Configure File Detection in user.json Source: http://wiki.freepascal.org/CudaText Map file extensions or names to lexer names for automatic syntax highlighting. Use '*' as a wildcard. A value of '-' disables detection for that pattern. ```json { … "detect": { "*.mht": "HTML", "myconfig.conf": "Nginx", ".profile": "Bash script", }, … ``` -------------------------------- ### Set window position and size Source: http://wiki.freepascal.org/CudaText Use the -w=left|top|width|height flag to set the position and size of the main window. Any number can be skipped to retain the previous value. ```bash cudatext -w=100,50,800,600 filename ``` -------------------------------- ### JSON Example for Folding Behavior Source: http://wiki.freepascal.org/CudaText This JSON structure demonstrates a scenario where CudaText's lexer might exhibit special folding behavior, specifically excluding the last line of a block from folding. ```json [ { 1: 2 }, { 3: 4 }, { 5: 6 } ] ``` -------------------------------- ### Specify settings folder Source: http://wiki.freepascal.org/CudaText Use the -s=folder flag to specify the full path of the 'settings' folder containing configuration files. ```bash cudatext -s=/path/to/settings filename ``` -------------------------------- ### Set IBUS_USE_PORTAL Environment Variable Source: http://wiki.freepascal.org/CudaText Setting this environment variable can resolve issues where CudaText displays an empty window that only populates after mouse interaction. ```bash IBUS_USE_PORTAL="1" ``` -------------------------------- ### Create Translation Zip Package for Plugin Menu Items Source: http://wiki.freepascal.org/CudaText Package translations for plugin menu items into a zip file named 'langmenu.MyPlugin.zip'. This zip must include an 'install.inf' file and the directory containing the translated menu item files (e.g., 'cuda_nnn'). ```zip langmenu.MyPlugin.zip (contains install.inf, cuda_nnn/ folder) ``` ```ini [info] title=Translation of menu items of MyPlugin type=cudatext-data subdir=langmenu ``` -------------------------------- ### Set Input Method for CudaText (Linux) Source: http://wiki.freepascal.org/CudaText Configure GTK_IM_MODULE and QT_IM_MODULE environment variables to 'ibus' in your OS environment file to resolve issues with national keyboards missing accent characters on Linux. ```bash GTK_IM_MODULE=ibus ``` ```bash QT_IM_MODULE=ibus ``` -------------------------------- ### Using Console as a Calculator in CudaText Source: http://wiki.freepascal.org/CudaText Demonstrates how to use the CudaText Console Panel as a calculator by prefixing Python expressions with '='. Importing math functions is also shown. ```python >>> from math import * ``` ```python >>> =pi 3.141592653589793 ``` ```python >>> =100/5+2 22.0 ``` -------------------------------- ### Disable Single Instance Mode Source: http://wiki.freepascal.org/CudaText Set the 'ui_one_instance' option to 'false' in 'user.json' to allow opening files in new windows instead of new tabs. ```json "ui_one_instance":false ``` -------------------------------- ### Configure Linux Renderer Tweaks Source: http://wiki.freepascal.org/CudaText Adjust the 'renderer_tweaks__linux' option to resolve text shifting issues on Linux Qt5 versions. Remove 'w' for simplified width calculation or add 'o' for slower but more accurate character offset rendering. ```json "renderer_tweaks__linux": "ws", ``` ```json "renderer_tweaks__linux" : "s", ``` ```json "renderer_tweaks__linux" : "wso", ``` -------------------------------- ### Create Translation Zip Package for CudaText Source: http://wiki.freepascal.org/CudaText Package translations into a zip file named 'translation.nn_NN.zip'. This zip must contain the 'nn_NN.ini' translation file and the 'install.inf' file. ```zip translation.nn_NN.zip (contains nn_NN.ini, install.inf) ``` -------------------------------- ### Display Alternative Statusbar Source: http://wiki.freepascal.org/CudaText Execute this command in the console to display an alternative status bar, allowing for theme adjustments. ```console msg_status_alt('d'*100, 8) ``` -------------------------------- ### Navigate to CudaText Folder Source: http://wiki.freepascal.org/CudaText Use the 'CD' command in a Windows console with administrative permissions to navigate to the directory containing CudaText files. ```batch C:\cudatext> ``` -------------------------------- ### Define Lexer Detection Rules Source: http://wiki.freepascal.org/CudaText Configure rules in 'user.json' to activate lexers based on the first line of a file using regular expressions. Use '-' for no lexer activation. ```json "<\?xml .+": "XML", "#\!\/bin\/(ba)?sh": "Bash script", "#\!\/usr\/bin\/env (ba)?sh": "Bash script", "#\!\/usr\/bin\/env python\d*": "Python", "#!.*\b(node|js|bun|osascript\s+-l\s+JavaScript)": "JavaScript" ``` -------------------------------- ### Enable WITH_GTK2_IM Define for ATSynEdit Source: http://wiki.freepascal.org/CudaText To resolve a specific compilation error on Linux related to ATSynEdit, enable the 'WITH_GTK2_IM' define in the Lazarus IDE's 'Build Lazarus' configuration. ```text WITH_GTK2_IM ``` -------------------------------- ### Configure Python Library Path for macOS (Default) Source: http://wiki.freepascal.org/CudaText Default configuration for the Python library path on macOS. CudaText typically auto-detects this, but manual configuration might be needed. ```json "pylib__mac": "/Library/Frameworks/Python.framework/Versions/3.5/lib/libpython3.5.dylib", ``` -------------------------------- ### Configure Python Library Path for Solaris Source: http://wiki.freepascal.org/CudaText Specify the path to the Python 3 shared library in 'user.json' for Solaris systems. This is necessary if CudaText does not automatically detect the library. ```json "pylib__solaris" : "/usr/lib/amd64/libpython3.5m.so", ``` -------------------------------- ### Do not load last session Source: http://wiki.freepascal.org/CudaText Use the -nsl flag to prevent loading the last session on startup. ```bash cudatext -nsl filename ``` -------------------------------- ### Configure Dynamic Highlight for HTML/PHP/Lua Source: http://wiki.freepascal.org/CudaText These settings enable dynamic highlighting for HTML, PHP, and Lua lexers. 'DynHighlight = dhBound' and 'HighlightPos = cpRange' are typically used together for these languages. ```config DynHighlight = dhBound HighlightPos = cpRange ``` -------------------------------- ### Fix Missing .so File Error on FreeBSD Source: http://wiki.freepascal.org/CudaText If CudaText fails to run on FreeBSD due to a missing .so file, create a symbolic link to resolve the issue. This command links libiconv.so.2 to libiconv.so.3. ```bash $ sudo ln -s /usr/local/lib/libiconv.so.2 /usr/local/lib/iconv.so.3 ``` -------------------------------- ### Enable Rendering Timing Log Source: http://wiki.freepascal.org/CudaText Set this hidden option to true to display rendering performance metrics in the editor corner, aiding in the analysis of rendering speed and repaint behavior. ```json "log_timing": true ``` -------------------------------- ### Specify file encoding Source: http://wiki.freepascal.org/CudaText Use the -e=value flag to open all files from the command line with a specified encoding. ```bash cudatext -e=utf8 filename ``` -------------------------------- ### Configure Python Library Path for Linux Source: http://wiki.freepascal.org/CudaText Specify the path to the Python 3 shared library in 'user.json' for Linux systems. This is necessary if CudaText does not automatically detect the library. ```json "pylib__linux" : "/usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0", ``` -------------------------------- ### Set Maximum File Size for Normal Lexer Source: http://wiki.freepascal.org/CudaText Configure the maximum file size (in Mbytes) for which a 'normal' lexer will be activated. 'Lite' lexers with a '^' suffix are still enabled for larger files. ```json "ui_max_size_lexer":2 ``` -------------------------------- ### Configure New Document Lexer Source: http://wiki.freepascal.org/CudaText Specify a custom lexer for new documents to automatically enforce a specific file extension, such as '.cfg', when saving files without an explicit extension. ```json "newdoc_lexer": "Cfg", ``` -------------------------------- ### Check Active Input Method (Linux) Source: http://wiki.freepascal.org/CudaText Determine the active Input Method (IM) on your Linux system by echoing the GTK_IM_MODULE environment variable in the terminal. This helps in troubleshooting keyboard input duplication issues. ```bash echo $GTK_IM_MODULE ``` -------------------------------- ### Configure UI Max Size Lexer Source: http://wiki.freepascal.org/CudaText This option controls the 'lite' lexer activation for very large XML files. Adjusting it can affect the richness of syntax highlighting and folding capabilities. ```json "ui_max_size_lexer": 2 ``` -------------------------------- ### Do not suggest creating new file Source: http://wiki.freepascal.org/CudaText Use the -nn flag to disable suggestions for creating a new file when a command-line filename is not found. ```bash cudatext -nn filename ``` -------------------------------- ### Define Plugin Menu Items for Translation Source: http://wiki.freepascal.org/CudaText Translate plugin menu items by creating ini files in the 'data/langmenu/cuda_nnn' directory. These files should be in UTF-8 no BOM encoding and contain a '[menu]' section mapping original item names to their translated versions. ```ini [menu] MyPlugin=local name ItemOne=local name of item ItemTwo=local name of item SubMenu=local name of menu ``` -------------------------------- ### Configure Comment and String Styles for Auto-Folding (Lexer Config) Source: http://wiki.freepascal.org/CudaText Define which syntax styles are considered comments or strings for the auto-folding feature. This is set in lexer map files. ```ini [comments] styles_cmt=Comment,Comment doc styles_str=Text,Tag string ``` -------------------------------- ### Set Maximum File Size for Opening Source: http://wiki.freepascal.org/CudaText Configure the maximum file size (in Mbytes) that CudaText will attempt to open and edit. Files larger than this limit can only be opened in a viewer. ```json "ui_max_size_open":500 ``` -------------------------------- ### Shell Extension File Sets (32-bit) Source: http://wiki.freepascal.org/CudaText These are the files included in the 32-bit version of CudaText for the Windows shell extension. Set 1 is for 32-bit Windows, and Set 2 is for 64-bit Windows. ```plaintext CudaText_shell32.dll install_shell32.cmd uninstall_shell32.cmd ``` ```plaintext CudaText_shell64.dll install_shell64.cmd uninstall_shell64.cmd ``` -------------------------------- ### Gutter Folding Right-Click Menu Options Source: http://wiki.freepascal.org/CudaText These menu items appear when right-clicking on the gutter's folding band. They allow folding/unfolding of specific blocks related to the clicked line, such as outer or inner blocks in JSON. ```text Line 6: "data": [{ Line 6: "data": [{ ```