### Build and Install Kajongg on Linux Source: https://docs.kde.org/stable5/en/kajongg/kajongg/installation This sequence of commands builds and installs Kajongg from its source code on a Linux system. It requires CMake, make, and the necessary development packages for Kajongg's dependencies. The process involves creating a build directory, configuring the build with CMake, compiling the code with make, and finally installing the application. ```bash cd kajongg mkdir build cd build cmake .. && make && make install ``` -------------------------------- ### Clone Kajongg Source Code Source: https://docs.kde.org/stable5/en/kajongg/kajongg/installation This command clones the Kajongg source code repository from KDE's GitLab instance. It requires Git to be installed on the system. The output is the source code of the Kajongg project. ```bash git clone https://invent.kde.org/games/kajongg.git ``` -------------------------------- ### KBackup Script Example: Mount/Unmount Media Source: https://docs.kde.org/stable5/en/kbackup/kbackup/developers A sample shell script demonstrating how to handle media mounting, unmounting, and ejection during KBackup operations. It responds to 'slice_init' and 'slice_finished' modes, optionally interacting with a specified mount point. Dependencies include standard shell utilities like 'mount', 'rm', 'umount', and 'eject'. ```shell #!/bin/sh mode=$1 archive=$2 target=$3 mountPoint=$4 case "$mode" in "slice_init" ) if [ "$mountPoint" != "" ] then mount /media/zip rm -f /media/zip/backup_2*.tar* fi ;; "slice_closed" ) ;; "slice_finished" ) if [ "$mountPoint" != "" ] then umount /media/zip eject /media/zip fi ;; esac ``` -------------------------------- ### Start Kate with a Named Session Source: https://docs.kde.org/stable5/en/kate/kate/fundamentals This command starts Kate with a specific session identified by `name`. If the session doesn't exist, it's created. If an instance with that session is already running, the specified files will be loaded into that existing instance. ```bash kate -s _name_ # or kate --start _name_ ``` -------------------------------- ### Display Kate Version Information Source: https://docs.kde.org/stable5/en/kate/kate/fundamentals This command shows the current version of the Kate text editor installed on your system. It's useful for checking compatibility or reporting issues. ```bash kate -v # or kate --version ``` -------------------------------- ### LATEX Document with Bibliography Example Source: https://docs.kde.org/stable5/en/kbibtex/kbibtex/quick-using A minimal LATEX document demonstrating how to include a bibliography. It sets the document class, includes a bibliography style, displays some text with a citation, and links to the bibliography file named 'example'. ```latex \documentclass{article} \begin{document} \bibliographystyle{plain}% Choose a bibliographic style Test file with a reference (see~\cite{Lamport86}). \bibliography{example} \end{document} ``` -------------------------------- ### Start Kate with a New Anonymous Session Source: https://docs.kde.org/stable5/en/kate/kate/fundamentals This command starts Kate with a fresh, unnamed session. It implies the `--new` option, ensuring a distinct instance is created, separate from any previously saved sessions. ```bash kate --startanon ``` -------------------------------- ### SQL INSERT Statement Example Source: https://docs.kde.org/stable5/en/kate/kate/kate-application-plugin-sql This example demonstrates how to insert data into a database table using the SQL plugin. It requires specifying the table name, column names, and the corresponding values to be inserted. ```sql INSERT INTO _table_name_ ("_feature1_", "_feature2_", "_feature3_", "_feature4_", "_feature5_") VALUES ("_value1_", "_value2_", "_value3_", "_value4_", "_value5_" ) ``` -------------------------------- ### Force Start of a New Kate Instance Source: https://docs.kde.org/stable5/en/kate/kate/fundamentals This option forces Kate to start a new instance, even if other instances are running. It's ignored if a session name is provided and already in use. If no parameters or URLs are given, it always forces a new instance. ```bash kate -n # or kate --new ``` -------------------------------- ### BibTeX Database Entry Example Source: https://docs.kde.org/stable5/en/kbibtex/kbibtex/introduction An example of a BibTeX database entry, showcasing the structure for an article. This format is character-based, field-based, and widely used for bibliographies, especially with LaTeX. ```bibtex @article{PAM_doi:10.1007/BF00048294, author = {Streitenberger, P. and Knott, John F.}, doi = {10.1007/BF00048294}, issn = {1573-2673}, journal = {{International Journal of Fracture}}, number = {3}, pages = {R49}, publisher = {Springer}, title = {{The calculation of crack opening area and crack opening volume from stress intensity factors}}, url = {http://dx.doi.org/10.1007/BF00048294}, volume = {76}, x-fetchedfrom = {SpringerLink}, year = {1995} } ``` -------------------------------- ### SQL SELECT Statement Example Source: https://docs.kde.org/stable5/en/kate/kate/kate-application-plugin-sql This example demonstrates how to retrieve data from a database table using the SQL plugin. It uses a basic SELECT * query to fetch all columns and rows from a specified table. Results can be displayed as a table or text. ```sql SELECT * FROM _table_name_ ``` -------------------------------- ### Example JSON Color Theme File for KDE Source: https://docs.kde.org/stable5/en/kate/katepart/color-themes This is an example of a JSON file used for defining color themes in KDE projects. It includes metadata, editor colors, text styles, and custom styles for syntax highlighting. The '_comments' key can be used for informal notes or links to original theme repositories. Note that 'editor-colors' and 'text-styles' might not be exhaustive in this example. ```json { "_comments": [ "This is a comment.", "If this theme is an adaptation of another, put the link to the original repository." ], "metadata": { "name" : "Breeze Light", "revision" : 5, "copyright": [ "SPDX-FileCopyrightText: 2016 Volker Krause ", "SPDX-FileCopyrightText: 2016 Dominik Haumann " ], "license": "SPDX-License-Identifier: MIT" }, "editor-colors": { "BackgroundColor" : "#ffffff", "CodeFolding" : "#94caef", "BracketMatching" : "#ffff00", "CurrentLine" : "#f8f7f6", "IconBorder" : "#f0f0f0", "IndentationLine" : "#d2d2d2", "LineNumbers" : "#a0a0a0", "CurrentLineNumber" : "#1e1e1e", _The other editor color keys... }, "text-styles": { "Normal" : { "text-color" : "#1f1c1b", "selected-text-color" : "#ffffff", "bold" : false, "italic" : false, "underline" : false, "strike-through" : false }, "Keyword" : { "text-color" : "#1f1c1b", "selected-text-color" : "#ffffff", "bold" : true }, "Function" : { "text-color" : "#644a9b", "selected-text-color" : "#452886" }, "Variable" : { "text-color" : "#0057ae", "selected-text-color" : "#00316e" }, _The other text style keys... }, "custom-styles": { "ISO C++": { "Data Type": { "bold": true, "selected-text-color": "#009183", "text-color": "#00b5cf" }, "Keyword": { "text-color": "#6431b3" } }, "YAML": { "Attribute": { "selected-text-color": "#00b5cf", "text-color": "#00b5cf" } } } } ``` -------------------------------- ### Start OProfile System-Wide Profiling Source: https://docs.kde.org/stable5/en/kcachegrind/kcachegrind/using-kcachegrind These commands initiate system-wide profiling using OProfile. 'opcontrol -s' starts the measurement, followed by running the target application. 'opcontrol -d' stops the measurement and writes results to '/var/lib/oprofile/samples/'. This requires root privileges. ```bash opcontrol -s # Run your application here opcontrol -d ``` -------------------------------- ### LSP Server Configuration Example (JSON) Source: https://docs.kde.org/stable5/en/kate/kate/kate-application-plugin-lspclient An excerpt from the LSP server configuration file, demonstrating how to define settings for various programming language servers. It includes commands to execute, highlighting mode mappings, and optional paths for server binaries. ```json { "servers": { "bibtex": { "use": "latex", "highlightingModeRegex": "^BibTeX$" }, "c": { "command": ["clangd", "-log=error", "--background-index"], "commandDebug": ["clangd", "-log=verbose", "--background-index"], "url": "https://clang.llvm.org/extra/clangd/", "highlightingModeRegex": "^(C|ANSI C89|Objective-C)$" }, "cpp": { "use": "c", "highlightingModeRegex": "^(C\+\+|ISO C\+\+|Objective-C\+\+)$" }, "d": { "command": ["dls", "--stdio"], "url": "https://github.com/d-language-server/dls", "highlightingModeRegex": "^D$" }, "fortran": { "command": ["fortls"], "rootIndicationFileNames": [".fortls"], "url": "https://github.com/hansec/fortran-language-server", "highlightingModeRegex": "^Fortran.*$" }, "javascript": { "command": ["typescript-language-server", "--stdio"], "rootIndicationFileNames": ["package.json", "package-lock.json"], "url": "https://github.com/theia-ide/typescript-language-server", "highlightingModeRegex": "^JavaScript.*$", "documentLanguageId": false }, "latex": { "command": ["texlab"], "url": "https://texlab.netlify.com/", "highlightingModeRegex": "^LaTeX$" }, "go": { "command": ["go-langserver"], "commandDebug": ["go-langserver", "-trace"], "url": "https://github.com/sourcegraph/go-langserver", "highlightingModeRegex": "^Go$" }, "python": { "command": ["python3", "-m", "pyls", "--check-parent-process"], "url": "https://github.com/palantir/python-language-server", "highlightingModeRegex": "^Python$" }, "rust": { "command": ["rls"], "path": ["%{ENV:HOME}/.cargo/bin", "%{ENV:USERPROFILE}/.cargo/bin"], "rootIndicationFileNames": ["Cargo.lock", "Cargo.toml"], "url": "https://github.com/rust-lang/rls", "highlightingModeRegex": "^Rust$" }, "ocaml": { "command": ["ocamlmerlin-lsp"], "url": "https://github.com/ocaml/merlin", "highlightingModeRegex": "^Objective Caml.*$" } } } ``` -------------------------------- ### Display Kate License Information Source: https://docs.kde.org/stable5/en/kate/kate/fundamentals This command displays the licensing terms under which the Kate text editor is distributed. Understanding the license is important for usage and redistribution. ```bash kate --license ``` -------------------------------- ### SQL DELETE Statement Example Source: https://docs.kde.org/stable5/en/kate/kate/kate-application-plugin-sql This example shows how to delete data from a database table using the SQL plugin. It requires specifying the table name and a WHERE clause to identify the rows to be deleted. ```sql DELETE FROM _table_name_ WHERE name = "_text_" ``` -------------------------------- ### .kateproject with Build System Integration Source: https://docs.kde.org/stable5/en/kate/kate/kate-application-plugin-projects Sets up a 'Kate' project with Git integration and a comprehensive build system configuration. It defines build, clean, install commands, and specific build targets with their respective build and run commands. ```json { "name": "Kate", "files": [ { "git": 1 } ], "build": { "directory": "build", "build": "make all", "clean": "make clean", "install": "make install", "targets": [ { "name": "all", "build_cmd": "ninja", "run_cmd": "./bin/kate" }, { "name": "kate", "build_cmd": "ninja kate-bin" } ] } } ``` -------------------------------- ### Display Kate Command Line Help Source: https://docs.kde.org/stable5/en/kate/kate/fundamentals This command displays a list of all available command-line options for the Kate text editor. It's useful for understanding the full range of functionalities that can be controlled via the terminal. ```bash kate --help ``` -------------------------------- ### Get Multi-line Comment Start Marker Source: https://docs.kde.org/index_application=katepart&branch=stable5&language=en&path=dev-scripting.html Returns the marker string indicating the beginning of a multi-line comment, determined by the given attribute. Used in code editors for block commenting. ```cpp String document.commentStart(_int _attribute__); ``` -------------------------------- ### Cursor Class Source: https://docs.kde.org/stable5/en/kate/katepart/dev-scripting Detailed documentation for the Cursor class, including its constructors, methods, and usage examples. ```APIDOC ## The Cursor Prototype A Cursor represents a text position within a document as a `(line, column)` tuple. ### Constructors 1. **`Cursor()`** * **Description**: Creates a new Cursor at position `(0, 0)`. * **Example**: `var cursor = new Cursor();` 2. **`Cursor(_int _line__, _int _column__)`** * **Description**: Creates a new Cursor at the specified line and column. * **Example**: `var cursor = new Cursor(3, 42);` 3. **`Cursor(_Cursor _other__)`** * **Description**: Copy constructor. Creates a copy of another Cursor object. * **Example**: `var copy = new Cursor(other);` ### Methods 1. **`Cursor.clone()`** * **Description**: Returns a distinct copy (clone) of the cursor. * **Returns**: A new `Cursor` object that is a copy of the original. * **Example**: `var clone = cursor.clone();` 2. **`Cursor.setPosition(_int _line__, _int _column__)`** * **Description**: Sets the cursor's position to the specified line and column. * **Since**: KDE 4.11 * **Example**: `cursor.setPosition(10, 5);` 3. **`bool Cursor.isValid()`** * **Description**: Checks if the cursor is in a valid state. A cursor is considered invalid if its line or column is set to `-1`. * **Returns**: `true` if the cursor is valid, `false` otherwise. * **Example**: `var valid = cursor.isValid();` 4. **`Cursor Cursor.invalid()`** * **Description**: Returns a new Cursor object representing an invalid position (`-1, -1`). * **Returns**: An invalid `Cursor` object. * **Example**: `var invalidCursor = cursor.invalid();` 5. **`int Cursor.compareTo(_Cursor _other__)`** * **Description**: Compares this cursor's position with another cursor. * **Returns**: * `-1` if this cursor is before `other`. * `0` if both cursors are at the same position. * `+1` if this cursor is after `other`. * **Example**: `var comparison = cursor.compareTo(otherCursor);` 6. **`bool Cursor.equals(_Cursor _other__)`** * **Description**: Checks if this cursor is at the exact same position as another cursor. * **Returns**: `true` if the cursors are equal, `false` otherwise. * **Example**: `var areEqual = cursor.equals(otherCursor);` 7. **`String Cursor.toString()`** * **Description**: Returns a string representation of the cursor in the format "`Cursor(line, column)`". * **Returns**: A string representing the cursor's position. * **Example**: `var cursorString = cursor.toString();` ``` -------------------------------- ### SQL UPDATE Statement Example Source: https://docs.kde.org/stable5/en/kate/kate/kate-application-plugin-sql This example illustrates how to update existing data in a database table using the SQL plugin. It requires specifying the table name, the columns to update, and the new values, along with a WHERE clause to target specific rows. ```sql UPDATE _table_name_ SET "_feature1_" = "_text_", "_feature2_" = "_text_", "_feature3_" = "_text_", "_feature4_" = "_text_", "_feature5_" = "_text_" ``` -------------------------------- ### Play Kdenlive Project using melt command Source: https://docs.kde.org/stable5/en/kdenlive/kdenlive/adding-clips This command-line tool allows you to play Kdenlive projects. It requires the 'melt' utility to be installed and is primarily for debugging or quick previews, not final presentation due to potential performance issues. ```shell melt yourproject.kdenlive ``` -------------------------------- ### Range Methods: Single Line and String Representation (JavaScript) Source: https://docs.kde.org/index_application=katepart&branch=stable5&language=en&path=dev-scripting.html Includes methods to check if a Range spans a single line and to get a string representation of the Range. `onSingleLine()` returns true if the start and end lines are the same. `toString()` formats the Range as a human-readable string. ```javascript bool Range.onSingleLine(); String Range.toString(); ``` -------------------------------- ### Regular Expression Quantifiers Syntax and Examples Source: https://docs.kde.org/stable5/en/kate/katepart/quantifiers Demonstrates various quantifier syntaxes in regular expressions, including exact occurrences, ranges, and abbreviations. These are used to control how many times a pattern element can repeat. Examples show usage with digits, whitespace, and specific sub-patterns. ```regex {1} ``` ```regex {0,1} ``` ```regex {,1} ``` ```regex {5,10} ``` ```regex {5,} ``` ```regex * ``` ```regex + ``` ```regex ? ``` ```regex ^\d{4,5}\s ``` ```regex \s+ ``` ```regex (bla){1,} ``` ```regex /?> ``` -------------------------------- ### Display Kate Authors Source: https://docs.kde.org/stable5/en/kate/kate/fundamentals This command lists the names of the developers who have contributed to the Kate text editor. It's a way to acknowledge the project's contributors. ```bash kate --author ``` -------------------------------- ### KDE Highlighting itemDatas Section Example Source: https://docs.kde.org/stable5/en/kate/katepart/highlight The itemDatas element in KDE highlighting definitions specifies color and font styles for contexts and rules. This example shows itemData definitions for 'Normal Text', 'Keyword', and 'String' styles, referencing 'defStyleNum' for style enumeration. ```xml class const str types##ISO C++ ``` -------------------------------- ### Open File with Kate from Command Line Source: https://docs.kde.org/stable5/en/kate/kate/fundamentals This command opens a local file named 'myfile.txt' in the Kate text editor. If the file does not exist, Kate will create it. This is a fundamental way to quickly edit files using Kate. ```bash %kate _myfile.txt_ ``` -------------------------------- ### KatePart Document Variable Syntax Example (C++, Java, JavaScript) Source: https://docs.kde.org/stable5/en/kate/katepart/config-variables This example demonstrates the syntax for setting document variables directly within a code file, specifically for indentation settings in C++, Java, or JavaScript. Variables are defined using the `kate: VARIABLENAME VALUE;` format, enclosed in comments if necessary. Only the first and last 10 lines are scanned for these variables. ```text // kate: replace-tabs on; indent-width 4; indent-mode cstyle; ``` -------------------------------- ### KDevelop Snippet Example: For Loop Source: https://docs.kde.org/stable5/en/kdevelop/kdevelop/working-with-source-code This snippet demonstrates a common C++ for loop structure used in KDevelop for iterating through triangulation cells. It's an example of a reusable text sequence that can be saved as a snippet to improve coding productivity. ```cpp for (typename Triangulation< dim>::active_cell_iterator cell = triangulation.begin_active(); cell != triangulation.end(); ++cell) ``` -------------------------------- ### Specify Desktop File for Kate Source: https://docs.kde.org/stable5/en/kate/kate/fundamentals This option allows specifying the base filename of the desktop entry for Kate. It's particularly useful for wrapper applications or those with multiple desktop files, allowing each to have a distinct command line. ```bash kate --desktopfile _filename_ ``` -------------------------------- ### Open Remote File with Kate from Command Line Source: https://docs.kde.org/stable5/en/kate/kate/fundamentals Leveraging KDE's network transparency, this command opens a file from an FTP server directly in Kate. Ensure you have an active connection and appropriate permissions to access the remote file. ```bash %kate _ftp://ftp.kde.org/pub/kde/README_ ``` -------------------------------- ### Range Methods: Emptiness and Equality (JavaScript) Source: https://docs.kde.org/index_application=katepart&branch=stable5&language=en&path=dev-scripting.html Provides methods to determine if a Range is empty or equal to another Range. `isEmpty()` returns true if the start and end cursors are identical. `equals()` checks if two Ranges represent the same start and end points. ```javascript bool Range.isEmpty(); bool Range.equals(_Range _other__); ``` -------------------------------- ### KTextEditor JSON Text Styles Configuration Example Source: https://docs.kde.org/stable5/en/kate/katepart/color-themes Illustrates the JSON structure for defining default text styles in KTextEditor. It shows the 'text-styles' object with examples for 'Normal' and 'Keyword' styles, including required color properties and optional boolean attributes like bold and italic. All listed text style keys are mandatory. ```json "text-styles": { "Normal" : { "text-color" : "#1f1c1b", "selected-text-color" : "#ffffff", "bold" : false, "italic" : false, "underline" : false, "strike-through" : false }, "Keyword" : { "text-color" : "#1f1c1b", "selected-text-color" : "#ffffff", "bold" : true }, "Function" : { "text-color" : "#644a9b", "selected-text-color" : "#452886" }, _The other text style keys... } ``` -------------------------------- ### C++ Class Declaration and Usage Example Source: https://docs.kde.org/stable5/en/kdevelop/kdevelop/what-is-kdevelop Demonstrates a simple C++ class declaration with a member function and its subsequent usage in a program. KDevelop's intelligence helps in code completion based on class definitions. ```cpp class Car { // ... public: std::string get_color () const; }; Car my_ride; // ...do something with this variable... std::string color = my_ride.ge ``` -------------------------------- ### Navigate to Specific Line and Column in Kate Source: https://docs.kde.org/stable5/en/kate/kate/fundamentals These commands open a file or URL and automatically navigate the cursor to a specified line and/or column number. This is helpful for quickly accessing specific parts of a document. ```bash kate -l _line_ _URL_ # or kate --line _line_ _URL_ kate -c _column_ _URL_ # or kate --column _column_ _URL_ ``` -------------------------------- ### KatePart Command Line Script - myutils.js Source: https://docs.kde.org/index_application=katepart&branch=stable5&language=en&path=dev-scripting.html Example of creating a custom command-line script file for KatePart. This script would be saved as `myutils.js` in the specified command directory and could contain various utility functions. ```javascript // myutils.js // Example custom script content would go here. // For instance, defining a 'sort' function: /* function sort(text) { // implementation for sorting return sortedText; } */ ``` -------------------------------- ### Open File with Specific Encoding in Kate Source: https://docs.kde.org/stable5/en/kate/kate/fundamentals This command opens a file or URL using a specified text encoding. It's crucial for correctly interpreting and displaying documents with character sets other than the system default. ```bash kate -e _encoding_ _URL_ # or kate --encoding _encoding_ _URL_ ``` -------------------------------- ### Set Temporary Directory for Kate Source: https://docs.kde.org/stable5/en/kate/kate/fundamentals This command sequence creates a directory for temporary files and sets the TMPDIR environment variable to point to it before launching Kate. This is useful for managing temporary file locations, which default to '/tmp'. ```bash %mkdir /tmp/kate -p && export TMPDIR=/tmp/kate && kate ``` -------------------------------- ### Range Methods: Cloning and Validity (JavaScript) Source: https://docs.kde.org/index_application=katepart&branch=stable5&language=en&path=dev-scripting.html Includes methods for creating a duplicate of a Range object and checking if the Range is valid. The `clone()` method returns a new Range with the same start and end points, while `isValid()` checks if both start and end cursors are within valid bounds. ```javascript Range Range.clone(); bool Range.isValid(); ``` -------------------------------- ### KDE Highlighting General Section Configuration Source: https://docs.kde.org/stable5/en/kate/katepart/highlight The general section in KDE highlighting definitions contains optional configuration for keywords, code folding, comments, indentation, and spell checking. This example demonstrates single-line and multi-line comments, case-sensitive keywords, and indentation-insensitive folding. ```xml ``` -------------------------------- ### Get Document Highlighting Mode - KDE Scripting Source: https://docs.kde.org/index_application=katepart&branch=stable5&language=en&path=dev-scripting.html Retrieves the global syntax highlighting mode applied to the entire document. ```javascript String document.highlightingMode(); ``` -------------------------------- ### Get Highlighting Information Source: https://docs.kde.org/stable5/en/kate/katepart/dev-scripting Provides information about the syntax highlighting modes applied to the document. This includes the global highlighting mode and the mode at specific positions or embedded modes. ```KDE Script String document.highlightingMode(); String document.highlightingModeAt(_Cursor _pos__); Array document.embeddedHighlightingModes(); ``` -------------------------------- ### Indentation Alignment Example in JavaScript Source: https://docs.kde.org/stable5/en/kate/katepart/dev-scripting Demonstrates a practical scenario of using the `indent()` function to align code across lines. It shows how returning `[8, 15]` for line 2, after line 1, results in proper alignment of a function call's arguments, considering tab widths. ```javascript /* Example Scenario: Assume using tabs to indent, and tab width is set to 4. Here, represents a tab and '.' a space: 1: foobar("hello", 2: ......."world"); When indenting line 2, the `indent()` function returns [8, 15]. As result, two tabs are inserted to indent to column 8, and 7 spaces are added to align the second parameter under the first. */ ``` -------------------------------- ### Add Bibliography Commands to LATEX Source: https://docs.kde.org/stable5/en/kbibtex/kbibtex/quick-using These commands are added to your LATEX file, typically at the end, to specify the bibliography file and style. \\`foo\\` should be replaced with the name of your .bib file, and \\`plain\\` is an example of a bibliography style. ```latex \bibliography{_foo_} \bibliographystyle{plain} ``` -------------------------------- ### Reuse Kate Instance by PID Source: https://docs.kde.org/stable5/en/kate/kate/fundamentals This option forces Kate to reuse an existing instance identified by its Process ID (PID). This is useful for ensuring that edits happen within a specific, already running Kate process. ```bash kate -p _PID_ # or kate --pid _PID_ ``` -------------------------------- ### Get First Non-Whitespace Character - KDE Scripting Source: https://docs.kde.org/index_application=katepart&branch=stable5&language=en&path=dev-scripting.html Returns the first non-whitespace character found in a specified line, starting from column 0. Returns an empty string if the line is empty or contains only whitespace. ```javascript String document.firstChar(_int _line__); ``` -------------------------------- ### Get Word Range at Position - KDE Scripting Source: https://docs.kde.org/index_application=katepart&branch=stable5&language=en&path=dev-scripting.html Returns the range (start and end positions) of the word at a given line and column or cursor. Returns an invalid range if the position is at the end of a line or if no word exists. Introduced in KDE 4.9. ```javascript Range document.wordRangeAt(_int _line__, _int _column__); Range document.wordRangeAt(_Cursor _cursor__); ``` -------------------------------- ### Treat Files as Temporary in Kate Source: https://docs.kde.org/stable5/en/kate/kate/fundamentals Files opened with this option are treated as temporary. They will be deleted upon closing if they are local and unmodified since opening. This helps keep the system clean by removing unneeded temporary files. ```bash kate --tempfile ``` -------------------------------- ### C++ Auto-completion Example in KDevelop Source: https://docs.kde.org/stable5/en/kdevelop/kdevelop/writing-source-code Demonstrates KDevelop's auto-completion feature in C++. When typing a member function call, KDevelop suggests possible completions based on the variable's type. This feature requires that the relevant class declarations are part of the current project. ```cpp class Car { // ... public: std::string get_color () const; }; void foo() { Car my_ride; // ...do something with this variable... std::string color = my_ride.ge ``` -------------------------------- ### Indenter Return Value Examples in JavaScript Source: https://docs.kde.org/stable5/en/kate/katepart/dev-scripting Illustrates how the `indent()` function can return different values to control code indentation. It shows returning an integer for simple indentation levels or an array for advanced alignment based on column position. ```javascript // Example of returning an integer for indentation level // return -2: do nothing // return -1: keep indentation // return 0 or positive integer: specifies the indentation depth in spaces // Example of returning an array for indentation and alignment // return [ indent, align ]; // where 'indent' is the indentation depth and 'align' is the absolute column for alignment. ``` -------------------------------- ### Providing Command Documentation with `help` (JavaScript) Source: https://docs.kde.org/stable5/en/kate/katepart/dev-scripting Demonstrates how to implement the `help` function in a Kate script to provide documentation for commands. The function receives the command name as an argument and should return a translated string describing the command. ```javascript function help(cmd) { if (cmd == "sort") { return i18n("Sort the selected text."); } else if (cmd == "...") { // ... } } ``` -------------------------------- ### Block Until Kate Instance Exits Source: https://docs.kde.org/stable5/en/kate/kate/fundamentals When opening files, this option causes Kate to block (wait) until the opened instance exits. This is essential for applications like Git or Subversion that need to wait for the commit message to be saved before proceeding. ```bash kate -b # or kate --block ``` -------------------------------- ### Range Validity and Emptiness Check Source: https://docs.kde.org/stable5/en/kate/katepart/dev-scripting Checks if a Range object is empty (start and end cursors are equal) or valid (both start and end cursors are valid). ```javascript bool Range.isEmpty(); // Example: var empty = range.isEmpty(); bool Range.isValid(); // Example: var valid = range.isValid(); ``` -------------------------------- ### KAlgebra: Lambda and Function Definition Source: https://docs.kde.org/stable5/en/kalgebra/kalgebra/syntax Illustrates the lambda operator '->' for defining functions with free variables and the definition operator ':=' for assigning values to variables or defining functions. Examples show binding variables and creating reusable functions. ```KAlgebra length:=(x,y)->(x*x+y*y)^0.5 x:=3 perimeter:=r->2*pi*r ``` -------------------------------- ### C++ Function Code with Variable Scope Example Source: https://docs.kde.org/stable5/en/kdevelop/kdevelop/what-is-kdevelop Illustrates two C++ functions with local variables of the same name. KDevelop differentiates these variables based on their scope, enabling precise refactoring and symbol usage analysis. ```cpp double foo () { double var = my_func(); return var * var; } double bar () { double var = my_func(); return var * var * var; } ``` -------------------------------- ### Check if Line Starts With Text - KDE Scripting Source: https://docs.kde.org/index_application=katepart&branch=stable5&language=en&path=dev-scripting.html Determines if a line begins with a specified string. An optional parameter controls whether leading whitespace should be ignored. ```javascript bool document.startsWith(_int _line__, _String _text__, _bool _skipWhiteSpaces__); ``` -------------------------------- ### Range Constructors (JavaScript) Source: https://docs.kde.org/index_application=katepart&branch=stable5&language=en&path=dev-scripting.html Provides various constructors for creating Range objects. These include default initialization, creation from start and end cursors, initialization with line and column numbers, and copying from an existing Range object. ```javascript Range(); Range(_Cursor _start__, _Cursor _end__); Range(_int _startLine__, _int _startColumn__, _int _endLine__, _int _endColumn__); Range(_Range _other__); ``` -------------------------------- ### Read Document Content from STDIN in Kate Source: https://docs.kde.org/stable5/en/kate/kate/fundamentals This option allows Kate to read the document's content from standard input (STDIN). It's commonly used with pipes, enabling you to direct the output of other commands into Kate for editing. ```bash kate -i # or kate --stdin ``` -------------------------------- ### Check for Text Match at Position - KDE Scripting Source: https://docs.kde.org/index_application=katepart&branch=stable5&language=en&path=dev-scripting.html Checks if a given string matches the text starting at a specific line and column, or cursor position. ```javascript bool document.matchesAt(_int _line__, _int _column__, _String _text__); bool document.matchesAt(_Cursor _cursor__, _String _text__); ``` -------------------------------- ### Clipboard Text Management (C++) Source: https://docs.kde.org/index_application=katepart&branch=stable5&language=en&path=dev-scripting.html Provides functions to get the current text from the global clipboard and to set the clipboard's content. Setting the clipboard text also adds the content to the clipboard history. ```cpp String editor.clipboardText(); ``` ```cpp void editor.setClipboardText( _String _text__); ``` -------------------------------- ### Start Document Edit Group Source: https://docs.kde.org/index_application=katepart&branch=stable5&language=en&path=dev-scripting.html Initiates an edit group, essential for enabling undo/redo functionality. It's crucial to pair every `editBegin()` call with a corresponding `editEnd()` call. This function supports nesting via internal reference counting. ```cpp void document.editBegin(); ``` -------------------------------- ### KAlgebra: Basic Arithmetic and Power Operators Source: https://docs.kde.org/stable5/en/kalgebra/kalgebra/syntax Demonstrates the use of fundamental arithmetic operators (+, -, *, /) and power operators (^, **) in KAlgebra. This allows for basic calculations and exponentiation, including fractional powers for roots. ```KAlgebra + - * / ^, ** a**(1/b) ``` -------------------------------- ### Get Document Attribute Name Source: https://docs.kde.org/index_application=katepart&branch=stable5&language=en&path=dev-scripting.html Returns the human-readable name of the attribute at a specific cursor position. This name corresponds to the itemData in syntax highlighting files. Provides a way to get a descriptive label for text styling. ```C++ String document.attributeName(_int _line__, _int _column__); String document.attributeName(_Cursor _cursor__); ``` -------------------------------- ### Basic Script Function Implementation (JavaScript) Source: https://docs.kde.org/index_application=katepart&branch=stable5&language=en&path=dev-scripting.html Illustrates the basic structure for implementing functions declared in the Kate script header. It includes the required import of 'range.js' and the function definition. The 'help' function is also shown for providing command-line documentation. ```javascript // required katepart js libraries, e.g. range.js if you use Range require ("range.js"); function (arg1, arg2, ...) { // ... implementation, see also: Scripting API } function help(cmd) { if (cmd == "sort") { return i18n("Sort the selected text."); } else if (cmd == "...") { // ... } } ``` -------------------------------- ### View API: Text Selection Management Source: https://docs.kde.org/stable5/en/kate/katepart/dev-scripting Functions for retrieving, checking, setting, and manipulating selected text. Includes getting selected text, checking for selection, getting the selection range, setting a specific range, removing selected text, selecting all text, and clearing the selection. ```javascript String view.selectedText(); // Returns the selected text. If no text is selected, the returned string is empty. ``` ```javascript bool view.hasSelection(); // Returns `true`, if the view has selected text, otherwise `false`. ``` ```javascript Range view.selection(); // Returns the selected text range. The returned range is invalid if there is no selected text. ``` ```javascript void view.setSelection(_Range _range__); // Set the selected text to the given range. ``` ```javascript void view.removeSelectedText(); // Remove the selected text. If the view does not have any selected text, this does nothing. ``` ```javascript void view.selectAll(); // Selects the entire text in the document. ``` ```javascript void view.clearSelection(); // Clears the text selection without removing the text. ``` -------------------------------- ### Basic .kateproject with Git Integration Source: https://docs.kde.org/stable5/en/kate/kate/kate-application-plugin-projects Defines a project named 'Kate' and specifies that its files should be managed using Git. This is a fundamental configuration for projects tracked by Git. ```json { "name": "Kate", "files": [ { "git": 1 } ] } ``` -------------------------------- ### Python LSP Server Configuration with Virtual Environment Source: https://docs.kde.org/stable5/en/kate/kate/kate-application-plugin-lspclient Configures the Python LSP server to use a wrapper script (`pylsp_in_env`) which executes the server within a project's virtual environment. This is useful for projects with distinct Python dependencies managed by virtual environments. The configuration specifies the command to run the server and sets the root directory relative to the project. ```json { "servers": { "python": { "command": ["pylsp_in_env"], ["%{Project:NativePath}"], "root": "." } } } ``` -------------------------------- ### FINDB Source: https://docs.kde.org/stable5/en/calligra/sheets/functions Finds a substring within another string using byte positions and returns the starting position. ```APIDOC ## FINDB ### Description Finds one text string (find_text) within another text string (within_text) and returns the number of the starting point of find_text, from the leftmost character of within_text using byte positions. Parameter BytePosition specifies the character at which to start the search. The first character is character number 2. If start_num is omitted, it is assumed to be 2. ### Return type Whole number (like 1, 132, 2344) ### Syntax FINDB(find_text;within_text;BytePosition Start) ### Parameters - **find_text** (Text) - The text you want to find - **within_text** (Text) - The text which may contain find_text - **BytePosition Start** (Whole number) - Specifies byte position to start the search ### Related Functions - FIND - SEARCH - REPLACE - SEARCHB - REPLACEB ``` -------------------------------- ### Keyword List Inclusion in KatePart Source: https://docs.kde.org/stable5/en/kate/katepart/highlight Demonstrates how to define keyword lists and include keywords from other lists or languages using the 'include' element in KatePart's highlighting XML. ```xml class const str ``` -------------------------------- ### Compare SVN Revisions with KDiff3 and KIO using kdesvn Source: https://docs.kde.org/stable5/en/kdesvn/kdesvn/kdesvn-kio This example demonstrates how to retrieve and compare differences between two specific revisions of an SVN repository using KDiff3 and the KIO ksvn protocol. It leverages kdesvn's internal Subversion mechanisms for efficient comparison. Requires KDiff3 and kdesvn with KIO support. ```bash kdiff3 \ ksvn://anonsvn.kde.org/home/kde/trunk/KDE/arts?rev=423127 \ ksvn://anonsvn.kde.org/home/kde/trunk/KDE/arts?rev=455064 ``` -------------------------------- ### Optimizing Character Detection in KDE Syntax Highlighting Source: https://docs.kde.org/stable5/en/kate/katepart/highlight This snippet demonstrates how to optimize character detection by using specialized rules like `DetectChar` and `Detect2Chars` instead of generic regular expressions for simple patterns. It shows how to match a specific character at the beginning of a line or in a specific column, improving performance. ```xml ``` ```xml ``` ```xml ``` ```xml ``` -------------------------------- ### CHAR() - Get character from code Source: https://docs.kde.org/stable5/en/calligra/sheets/functions The CHAR() function returns the character corresponding to a specified numeric code. ```APIDOC ## CHAR() ### Description Returns the character specified by a number. ### Syntax CHAR(code) ### Parameters * **code** (Whole number) - The numeric code of the character. ### Request Example ```json { "function": "CHAR", "arguments": [ 65 ] } ``` ### Response #### Success Response (200) * **return_value** (Text) - The character corresponding to the code. #### Response Example ```json { "return_value": "A" } ``` ``` -------------------------------- ### Creating a Custom Command-Line Script in JavaScript Source: https://docs.kde.org/stable5/en/kate/katepart/dev-scripting Explains how to create custom command-line helper scripts for KatePart. It outlines the process of creating a `.js` file (e.g., `myutils.js`) in the specified directory (`$XDG_DATA_HOME/katepart5/script/commands`) to extend KatePart's functionality. ```javascript // Example of a custom command-line script file named 'myutils.js' // located in '$XDG_DATA_HOME/katepart5/script/commands' // Functionality for a custom command would be defined here. // For example, to create a 'sort' command: /* function sort(text) { // Implementation of sorting logic return sortedText; } */ ``` -------------------------------- ### BETADIST Function Source: https://docs.kde.org/stable5/en/calligra/sheets/functions Returns the cumulative beta probability density function. Optional start and end parameters define the bounds. ```APIDOC ## BETADIST ### Description Returns the cumulative beta probability density function. The third and fourth parameters (start and end bounds) are optional, defaulting to 0.0 and 1.0 respectively. ### Syntax `BETADIST(number;alpha;beta;[start];[end];[cumulative=TRUE]) ### Parameters - **number** (floating point value) - Required - The value for which to evaluate the distribution. - **alpha** (floating point value) - Required - Parameter alpha of the beta distribution. - **beta** (floating point value) - Required - Parameter beta of the beta distribution. - **start** (floating point value) - Optional - The lower bound of the distribution. - **end** (floating point value) - Optional - The upper bound of the distribution. - **cumulative** (truth value) - Optional - If TRUE, returns the cumulative distribution function; otherwise, returns the probability density function. ### Examples ``` BETADIST(0.2859;0.2606;0.8105) // equals 0.675444 BETADIST(0.2859;0.2606;0.8105;0.2;0.9) // equals 0.537856 ``` ``` -------------------------------- ### CODE() - Get numeric code of a character Source: https://docs.kde.org/stable5/en/calligra/sheets/functions The CODE() function returns the numeric code of the first character in a text string. ```APIDOC ## CODE() ### Description Returns a numeric code for the first character in a text string. ### Syntax CODE(text) ### Parameters * **text** (Text) - The input text string. ### Request Example ```json { "function": "CODE", "arguments": [ "KDE" ] } ``` ### Response #### Success Response (200) * **return_value** (Whole number) - The numeric code of the first character. #### Response Example ```json { "return_value": 75 } ``` ``` -------------------------------- ### BETAINV Function Source: https://docs.kde.org/stable5/en/calligra/sheets/functions Returns the inverse of the cumulative beta probability density function. Optional start and end parameters define the bounds. ```APIDOC ## BETAINV ### Description Returns the inverse of the cumulative beta probability density function (BETADIST(x;alpha;beta;a;b;TRUE())). The start and end parameters are optional, defaulting to 0.0 and 1.0 respectively. ### Syntax `BETAINV(number;alpha;beta [; start=0 [; end=1]]) ### Parameters - **number** (floating point value) - Required - The probability value for which to find the inverse. - **alpha** (floating point value) - Required - Parameter alpha of the beta distribution. - **beta** (floating point value) - Required - Parameter beta of the beta distribution. - **start** (floating point value) - Optional - The lower bound of the distribution. - **end** (floating point value) - Optional - The upper bound of the distribution. ### Examples ``` BETADIST(BETAINV(0.1;3;4);3;4) // equals 0.1 BETADIST(BETAINV(0.3;3;4);3;4) // equals 0.3 ``` ``` -------------------------------- ### NETWORKDAY Function Source: https://docs.kde.org/stable5/en/calligra/sheets/functions The NETWORKDAY() function calculates the number of working days between a start date and an end date, optionally considering holidays. ```APIDOC ## NETWORKDAY Function ### Description Returns the number of working days between start date and end date. Holidays can be specified. ### Syntax NETWORKDAY(start date; end date; holidays) ### Parameters #### Path Parameters * **start date** (Text) - The starting date for the calculation. * **end date** (Text) - The ending date for the calculation. * **holidays** (Text) - Optional. A number, single date, or array of dates to be considered holidays. ### Request Example ```json { "function": "NETWORKDAY", "parameters": { "start date": "01/01/2001", "end date": "01/08/2001" } } ``` ### Response #### Success Response (200) - **result** (Whole number) - The number of working days. #### Response Example ```json { "result": 5 } ``` ```