Unryu: Editing

How to write and change text in Unryu: the Edit menu, the Document menu, the help Unryu gives while you type, completions and snippets, folding, bookmarks, block selection, and the ways to move around a file. Each command is listed with its keys. The full list of keys is on the Keyboard shortcuts page, and Help > Keyboard Shortcuts shows it inside Unryu.

Some things that used to be on this page now have pages of their own: Find in Files is in Find and Replace; the compiler check (Suggest Repairs) and the Terminal tab are in Build and Run; files that change on disk, file templates, encodings and line endings are in Files and Recovery.

1. The basics

Click in the editor and type. The cursor keys work as in most editors:

KeyWhat it does
Left Right Up DownMove the cursor by one character or one line. When lines wrap, Up and Down move by one screen row and keep the cursor at about the same distance across. A folded block counts as one line.
Home / EndGo to the start or the end of the line. With "Smart" home key on (the default), the first Home goes to the first character that is not a space or tab, and a second Home goes to column 1.
Ctrl+Home / Ctrl+EndGo to the start or the end of the document.
Page Up / Page DownScroll by one screen and move the cursor with it.
Alt+Up / Alt+DownScroll the view up or down by one line, without moving the cursor.
Ctrl+Shift+LScroll to the current line: the line with the cursor goes to the middle of the view.
Shift with the arrow keys, Home, End, Ctrl+Home or Ctrl+EndSelects text as the cursor moves.
Ctrl+Shift+DeleteDelete from the cursor to the end of the line.
Ctrl+Shift+BackSpaceDelete from the start of the line to the cursor.

With the mouse, a click places the cursor, a drag selects, a double click selects a word and a triple click selects a line. A click on a line number selects that line. Ctrl+click on a name goes to its definition (see section 13).

Undo and redo. Every command on this page is one step for Undo, however much text it changes: one Ctrl+Z takes back all of it. Most commands with nothing to do change nothing and add no Undo step. Reflow on text that is already wrapped, and Toggle Case on a word with no letters, still add an Undo step and mark the document as changed. Redo is Ctrl+Y (or Ctrl+Shift+Z). Edit > Undo and Edit > Redo, and the toolbar's Undo and Redo buttons, are greyed when there is nothing to undo or redo.

The right-click menu of the editor has Cut, Copy, Paste, Select All, Undo, Redo, Context Action and, when you right-click on a web or mail address in a comment or a string (or anywhere in prose), Open Link (in your browser) and Copy Link (to the clipboard); Ctrl+click opens one as well (Code analysis). On a word that Check Spelling marked, it has the word's suggestions, Add to Dictionary and Ignore All (section 14). In a Read Only document, Cut, Paste, Undo and Redo are greyed.

The middle button pastes the text you selected last, in Unryu or in any other program, where you click (the primary selection, as in every X program). Text you select in the editor, with the mouse or with Shift and the arrow keys, can be pasted the same way into a terminal or another program. This leaves the clipboard (Ctrl+C, Ctrl+V) as it was. Context Action runs the command in Preferences > Tools > Context action, with %s replaced by the selection, or by the word at the cursor when nothing is selected. Unryu puts that text in single quotes, so a word from a file cannot add shell commands. When the field is empty, the status bar says "No context action set." If Unryu cannot start the shell for it, the status bar and the Status tab say which command failed. A command that starts but then fails (for example a program that is not installed) is not reported. With nothing selected and no word at the cursor, Unryu beeps and runs nothing. For example, the command xdg-open https://devdocs.io/#q=%s looks up the word at the cursor.

Markdown documents. When a Markdown file is shown as formatted text, Undo, Redo, Cut, Copy, Paste and Select All of the Edit menu act on that formatted view.

2. The Edit menu

ItemKeysWhat it does
UndoCtrl+ZTakes back the last change.
RedoCtrl+YDoes again what Undo took back.
CutCtrl+XMoves the selection to the clipboard.
CopyCtrl+CCopies the selection to the clipboard.
PasteCtrl+VPuts the clipboard's text at the cursor, in place of the selection if there is one.
Delete(none; the Delete key does the same)Deletes the selection, or the character after the cursor.
Select AllCtrl+ASelects the whole document.
Commands ▸Commands on whole lines: see section 3.
Format ▸Commands that change the form of the text: see section 4.
Insert Comments ▸Insert Multiline Comment, Insert Documentation Comment: see section 5.
Insert Date ▸Shift+Alt+D (custom format)Puts the date and time at the cursor: see section 5.
Insert "include <...>" ▸Puts a C or C++ #include line at the cursor: see section 5.
Insert Alternative White SpacePuts a non-breaking space (U+00A0) at the cursor.
Insert Placeholder Text...Asks how many characters (1 to 100000), and puts that much "Lorem ipsum dolor sit amet ..." at the cursor, in place of the selection: placeholder text for a web page or a layout. Longer than the text, it starts again after a space. The dialog offers the last length you gave.
Insert Unicode Character...Ctrl+Shift+UAsks for a character's code point and puts the character at the cursor, in place of the selection. Write the code point in hexadecimal, as U+00E9, 0xE9 or E9, or as &#233; or &#xE9;. The status bar shows the code point of the character at the cursor, and Details its name (Code analysis).
PreferencesCtrl+Alt+POpens the Preferences dialog (Preferences).

3. Edit > Commands

These commands work on the lines the selection covers, or on the cursor's line when nothing is selected. A selection that ends at the very start of a line does not count that line, so a selection made by dragging down to the start of the next line takes only the lines you see highlighted.

ItemKeysWhat it does
Cut Current Line(s)Ctrl+Shift+XSelects the whole lines, with their line ends, and cuts them to the clipboard.
Copy Current Line(s)Ctrl+Shift+CSelects the whole lines, with their line ends, and copies them. The lines stay selected.
Delete Current Line(s)Ctrl+KDeletes the whole lines. The clipboard does not change.
Duplicate Line or SelectionCtrl+DWith a selection inside one line: puts a copy of the selected text right after it. Otherwise: puts a copy of the line, or of all the selected lines, below them. The selection stays where it was.
Select Current Line(s)Shift+Alt+LSelects the whole lines, with their line ends.
Select Current ParagraphShift+Alt+PSelects the paragraph around the cursor: the lines up to the nearest blank line above and below. On a blank line, only that line is selected.
Move Line(s) UpAlt+Page UpMoves the lines above the line before them. The selection moves with them.
Move Line(s) DownAlt+Page DownMoves the lines below the line after them.
Sort LinesSorts the lines by their bytes: capitals before small letters, file10 before file2.
Sort Lines, Ignore CaseSorts them with capitals and small letters alike, in every alphabet (É as é).
Sort Lines, Natural OrderSorts them with numbers by their value: file2 before file10.
Sort Lines and Remove DuplicatesSorts them by their bytes and keeps one of each line.
Remove Duplicate LinesKeeps the first of each line where it is, and removes the later copies. The order stays.
Remove Empty LinesRemoves the lines that have nothing on them. A line of spaces is not empty.
Send Selection to TerminalTypes the selection (or the cursor's line) into the shell of the Terminal tab, followed by Return. When the Terminal tab is off, Unryu runs it in the terminal program of Preferences > Tools > Terminal instead. Details are in Build and Run.

One more key selects text: Shift+Alt+W selects the word at the cursor (letters, digits and _).

The sorts and removals work on the lines the selection covers, by the rule above, or on the whole document when nothing is selected. Lines are compared exactly, byte for byte (only Ignore Case and Natural Order compare otherwise), and lines that compare equal keep their order. Every line keeps its line end (LF or CRLF), and a last line with no line end still has none afterwards: a sort never joins two lines. The result is selected, and one Undo takes it all back. When nothing would change, the status bar says so. They are grey while a block selection is active. You can give each a key in Keybindings.

4. Edit > Format

ItemKeysWhat it does
Join LinesJoins the selected lines into one line. With no selection it joins the paragraph around the cursor. The spaces at the end of each line and the indentation at the start of each following line are removed, and one space goes between the parts.
Reflow Lines/BlockCtrl+JRewraps the selected lines (or, with no selection, the paragraph) so that no line goes past the long line marker's column (Preferences > Editor > Display > Long line marker > Column, 72 at first). Lines break only at spaces, and each new line gets the indentation of the first line. A word longer than the room stays whole on its own line.
Toggle Case of SelectionCtrl+Alt+UWhen the selection has any capital letter, it becomes all small letters; otherwise all capitals. With no selection it works on the word at the cursor. Only the letters A to Z change; accented and other letters stay as they are.
Shift Column Left, Shift Column Rightnone (set them in Keybindings)Moves the selected text one column left or right, and it stays selected: the character before it goes after it, or the one after it goes before it. A selection must be within one line. With a block selection (section 12), every line of the block moves, and the block with it; going right past a line's end, a space comes in. A selection over several lines that is not a block, or one at the edge of its line, does not move, and the status bar says why. One Undo step.
Escape UnicodeTurns every character past ASCII in the selection into an escape, the way the document's language writes one in a string: é becomes \u00E9 in C, Python and Go, &#xE9; in HTML and XML, \u{E9} in Rust and Swift; past U+FFFF, C writes \U0001F600 and Java a surrogate pair \uD83D\uDE00. The language file says which (unicode-escape); a language with none says so in the status bar.
Unescape UnicodeThe other way: every escape in the selection becomes its character, whatever the language: \u00E9 (a surrogate pair too), \U0001F600, \u{E9}, \x{E9}, &#xE9;, &#233;, and runs of \xC3\xA9 that are UTF-8. Anything else stays as it is.
Comment Line(s)Puts the language's comment sign in front of each line, after its indentation. Blank lines stay as they are.
Uncomment Line(s)Takes the comment sign away from the start of each line that has one.
Toggle Line CommentationCtrl+EEach line that starts with the comment sign followed by the comment toggle marker loses both; every other line gets them. With C and the default marker, x = 1; becomes //~ x = 1; and back. Because of the marker, a comment that you wrote yourself (// note) is not mistaken for code that was commented out: toggling it adds //~ in front.
Increase IndentCtrl+IMoves each line one indentation step to the right. Empty lines get no indentation.
Decrease IndentCtrl+UMoves each line one indentation step to the left, as far as column 1.
Smart Line IndentGives each line exactly the indentation of the line above the first one. With no selection, the cursor goes to the end of the new indentation. On the first line it does nothing.
Convert Table ▸Turns the selected lines into a table. Each line is a row and its cells are separated by tabs, as they are when you copy cells from a spreadsheet; blank lines are left out, and a short row gets empty cells. Choose HTML Table, LaTeX Tabular, SQL INSERT (one INSERT INTO table_name with a row of values for each line: numbers as they are, other cells in quotes), Markdown Table or CSV. With First Row Is a Header checked (as it is at first), the first line is the header row (bold in LaTeX; in SQL, the column names). Each format escapes what it must: & < > in HTML, & % $ # _ { } ~ ^ \ in LaTeX, ' in SQL, | in Markdown, and quotes in CSV. The table keeps the lines' line ends (CRLF stays CRLF) and is selected; one Undo takes it back.
Enclose Selection ▸Enclose 1 to 8 in KeybindingsPuts the selected text between the two characters of a pair, and keeps it selected: ( and ), « and » and the others you set in Preferences > Editor > Completions. With nothing selected, it does nothing and says so.
Send Selection to ▸Your own filter commands, then Set Custom Commands (below).

The comment sign comes from the language file: its comment-toggle value (for example "# " in Python), or else its first line comment. A language with neither, such as plain text, has nothing to comment with, and these commands do nothing. Comment Line(s) uses the sign as written; Toggle uses it without its trailing spaces, followed by the marker. The marker is set in Preferences > Editor > Features > Comment toggle marker (~ at first). See Languages for the language files.

Indentation steps are the document's indent width, and the indentation is made of tabs, spaces, or both, as Document > Indent Type says (section 9). The toolbar's Indent and Unindent buttons do the same as Increase Indent and Decrease Indent.

Send Selection to: your own filter commands

A custom command is a shell command that gets text on its input and gives back new text on its output, such as sort, tac, column -t, python3 -m json.tool or fmt -w 60. Choose Edit > Format > Send Selection to > Set Custom Commands. A dialog shows all your commands in one field, with ;; between two of them, for example sort ;; tac ;; column -t. You can have up to ten. OK keeps them; an empty field removes them all.

Each command then has its own item in the Send Selection to menu (showing at most the first 60 characters of the command). When you choose one, Unryu runs it with /bin/sh -c and gives it the selection, or the cursor's line (with its line end) when nothing is selected. When the command ends with status 0 within 10 seconds, its output replaces that text as one Undo step, and the Status tab says "Passed data to the custom command". When it fails, or runs longer than 10 seconds (Unryu stops it then), the text stays as it was and the Status tab says that the command failed, with its exit status. What the command writes to its error output is not shown.

5. Inserting text

ItemWhat it puts in
Edit > Insert Comments > Insert Multiline CommentA C-style block comment, /*, * , */ on three lines, at the start of the cursor's line. The cursor goes to the middle line. It is the same in every language.
Edit > Insert Comments > Insert Documentation CommentA documentation comment for the function the cursor is in (or, outside every function, the next one below), made from its signature as Kami reads it: a line for what it does, a line for each parameter, and a line for what it returns when it returns something (a type that is not void before its name, or one after its list that is not None or void). The cursor goes to the first line; Tab goes to each next one (places to fill). The form is the language's own: Doxygen (/** @brief ... @param ... @return */) in C, C++ and their family; Javadoc (the same, without @brief) in the other languages with /* */ comments; a docstring under the def line, with :param x: and :return:, in Python; /// <summary> in C#; /// - Parameter x: in Swift; /// # Arguments in Rust; // Name in Go; --- and -- @param in Lua; and the line comment with @param in the others. A function that has a documentation comment already gets none. It has no key at first: give it one in Preferences > Keybindings (Edit, Insert Documentation Comment).
Edit > Insert Date > dd.mm.yyyy, mm.dd.yyyy, yyyy/mm/ddToday's date in that form, at the cursor.
Edit > Insert Date > dd.mm.yyyy hh:mm:ss, mm.dd.yyyy hh:mm:ss, yyyy/mm/dd hh:mm:ssThe date and the time now (24-hour clock).
Edit > Insert Date > Use Custom Date Format (Shift+Alt+D)The date and time in your own format.
Edit > Insert Date > Set Custom Date FormatNothing: it asks for your own format, which Use Custom Date Format and Shift+Alt+D then use.
Edit > Insert "include <...>" > #include "..."#include "" and a line end at the cursor, with the cursor between the quotes, ready for a file name.
Edit > Insert "include <...>" > a header#include <name> and a line end at the cursor. The headers are in five groups: C Standard Library (assert.h, ctype.h, errno.h, float.h, limits.h, locale.h, math.h, setjmp.h, signal.h, stdarg.h, stddef.h, stdio.h, stdlib.h, string.h, time.h); ISO C99 (complex.h, fenv.h, inttypes.h, iso646.h, stdbool.h, stdint.h, tgmath.h, wchar.h, wctype.h); C++ (C Standard Library) (cstdio, cstring, cctype, cmath, ctime, cstdlib, cstdarg); C++ Standard Library (iostream, fstream, iomanip, sstream, exception, stdexcept, memory, locale); C++ STL (bitset, deque, list, map, set, queue, stack, vector, algorithm, iterator, functional, string, complex, valarray).
Edit > Insert Alternative White SpaceA non-breaking space (U+00A0).
Edit > Insert Placeholder Text"Lorem ipsum ..." of the length you give.
Edit > Insert Unicode Character (Ctrl+Shift+U)Any character, by its code point.

The custom date format uses the strftime codes: %Y the year, %m the month, %d the day, %H, %M and %S the hour, minute and second, %A the day's name, %B the month's name, %% a percent sign. For example %Y-%m-%d %H:%M gives 2026-11-15 14:30. Until you set one, the format is %d.%m.%Y. You can also change it in Preferences > Various (custom-date-format). When a format gives no text (for example because it is too long), Unryu beeps (when Preferences > General > "Beep on errors or when compilation has finished" is on, as it is by default) and the Status tab says "Date format string could not be converted".

6. Help while you type

Unryu changes a few keys as you type, so that code keeps its shape. Each can be switched off in Preferences > Editor. None of them acts while Ctrl or Alt is held, or while a block selection (section 12) is active.

You typeWhat Unryu doesSetting
EnterThe new line gets indentation, as the auto-indent mode says (below).Indentation > Auto-indent mode; Document > Auto-indentation
Text in a #define that goes over linesIn C and its relatives, the backslashes that end the lines of the #define stay lined up as you type. When they were all in one column, they stay in that column, and all move right when a line grows past it; when each had one space before it, each keeps one; any other layout is left as it is. Enter before the backslash of such a line ends the line you leave with a backslash too, and the new line is indented as the line (one step in after the #define line itself).Features > Keep the backslashes of a #define lined up (on)
Enter after spacesWith "Newline strips trailing spaces", the spaces and tabs at the end of the line you leave are removed.Features > Newline strips trailing spaces (off at first)
Enter in a /* */ commentAfter a line that starts with /*, the new line starts with * ; after a line that starts with *, with * . After the line that closes the comment with */, nothing is added.Completions > Automatic continuation of multi-line comments (on)
} on a line that has nothing elseThe line moves back to the indentation of its block (not when other text is on the line).Auto-indent mode Current chars or Match braces
Tab in the indentationIndents to the next indentation step.Indentation > Tab key indents (on)
Tab after textPuts a tab; when the indent type is Spaces, puts spaces up to the next tab stop.
Tab / Shift+Tab with several lines selectedIndents or unindents all of them by one step. The lines stay selected, so you can press it again.
Shift+TabUnindents the cursor's line by one step. When the line has no indentation, it does nothing.
BackSpace in the indentationGoes back one whole indentation step, not one character.Indentation > Backspace key unindents (on)
HomeSmart Home, see section 1.Features > "Smart" home key (on)
( [ { ' "The closing character comes too, and the cursor goes between them, when the new bracket or quote would otherwise have no partner. With text selected, the pair goes around the selection, which stays selected. See Auto-close below.Completions > Auto-close quotes and brackets (each off at first)
> that ends an opening tagIn HTML, XML and the other markup languages, <div class="a"> gets its </div> after the cursor. Not after />, a comment <!, a declaration <?, a closing tag, or (in HTML and PHP) an empty element such as br, img, input, hr, meta or link. A tag with a snippet (<ul>, <table> ...) gets the snippet instead (section 8).Completions > XML/HTML tag auto-closing (on)
A character past the long line columnWith Document > Line Breaking on, the line breaks at its last space before the column, and the new line keeps the indentation.Document > Line Breaking (off)
Tab after a snippet's wordThe word becomes the snippet's code (section 8).Completions > Snippet completion (on)
Tab in a snippet or a callThe next place to fill (section 8).None

Auto-close

Preferences > Editor > Completions > Auto-close quotes and brackets has a check box for each of ( ), { }, [ ], ' ' and " ". All are off at first. For each one you check:

You typeWhat Unryu does
The opening characterThe closing one comes too, and the cursor goes between them: f( gives f().
The opening character with text selectedThe pair goes around the text, and the text stays selected: select x + 1 and type ( to get (x + 1).
The closing character right before the one auto-close typedThe cursor steps over it, so you do not get two.
Tab right before the closing character auto-close typedThe cursor steps out of the pair.
BackSpace between an empty pairBoth characters go: (|) becomes |.
Enter between { and }A block: the cursor goes on a new line one indentation step in, and the } on the line after it, at the indentation of the line with the {.
{ after struct, union, enum or (in C++) classThe block gets its ; too: struct point { gives struct point {};. Not after a function that returns a struct, or after =.

Unryu closes a bracket or a quote only where the closing one is wanted. The rules use what Unryu understands of the code (how Unryu reads code), so a bracket inside a string or a comment never counts:

Right after you type, Unryu may not have read the new text yet. Then it decides from the characters alone: a bracket is not closed when the brackets after the cursor leave a closing one without a partner.

The auto-indent modes

Preferences > Editor > Indentation > Auto-indent mode chooses what Enter gives:

ModeThe new lineA } typed at the start of a line
NoneStarts at column 1.Stays where it is.
BasicGets the same indentation as the line above.Stays where it is.
Current chars (the default)Gets the same indentation, and one step more after a line that opens a { block, or that ends with one of the language's "indent after" characters (the : of Python).Goes back one step, unless it is already further left than the line above.
Match bracesAs Current chars.Goes to the indentation of the line with its matching {.

When Enter decides whether a line opens a block, braces inside strings, character constants and // or /* */ comments are not counted. When } is typed in Match braces mode, every brace counts, so a brace in a string or comment can change where the } goes. When the indent type is Tabs and the new line has the same indentation as the old one, Unryu copies the old line's tabs and spaces exactly, so spaces used for alignment after the tabs are kept. Document > Auto-indentation switches all of this off for one document. The "indent after" characters are the indent-after key of a language file (Languages).

7. Autocompletion

While you type a word, a list under the cursor shows the names that begin with what you typed. It appears when the word has as many characters as "Characters to type for autocompletion" (4 at first). A word that starts with a digit gets no list. Ctrl+Space shows the list at once, as soon as there is at least one letter of the word before the cursor.

All of these settings are in Preferences > Editor > Completions. The same page has "Symbol list update frequency": how often, in milliseconds, the symbol list in the sidebar is made again while you type (250 at first; 0 makes it again only when you save).

8. Snippets

A snippet is a short word that turns into a piece of code. Type the word, then press Tab. For example, in C, for and Tab gives:

for (i = 0; i < |; i++)
{

}

with the cursor where the | is. The word must be right before the cursor, with nothing selected. When the word is not a snippet, Tab works as usual. Snippet completion can be switched off in Preferences > Editor > Completions.

The built-in snippets are:

LanguageWords
Cif, else, for, while, do, switch, struct, main
C++if, else, for, while, do, switch, try, class
Javaif, else, for, while, try
C#if, for, foreach
JavaScriptif, for, function
PHPif, for, foreach
Pythonfor, if, elif, else, while, try, with, def, class
Rubyif, def
Shellif, for, while, case
LaTeXThe LaTeX plugin's menus. Environments: document, itemize, enumerate, description, item, figure, table, tabular, equation, align, center, verbatim, quote, abstract, minipage, frame. Structure: chapter, section and subsection (each with its \label), subsubsection, paragraph. Formatting: textbf, textit, emph, texttt, textsc, underline, tiny, small, large, Large, huge, footnote. References: label, ref, eqref, pageref, cite, href, url, bibliography. Others: includegraphics, usepackage, newcommand, frac, sqrt, sum, int. Each word becomes its command (figure and Tab: the figure environment, its places the file, the caption and the label).
HTMLafter a tag (see Snippets on a tag, below): <table>, <tr>, <ul>, <ol>, <dl>, <select>, <html>

Your own snippets

Write them in ~/.config/unryu/snippets.conf. Tools > Configuration Files > snippets.conf opens the file (and makes it, when it does not exist yet). The file has the same form as Geany's snippets.conf, so a Geany file can be copied over. A snippet in your file is used in place of a built-in snippet with the same word. Unryu reads the file each time you expand a snippet, so a change works at once.

[C]
fori=for (int i = 0; i < %cursor%; i++)%block_cursor%
inc=#include <%cursor%>

[Python]
main=if __name__ == "__main__":\n\tmain()%cursor%

[Default]
todo=TODO(me): %cursor%

Places to fill

Each %cursor% of a snippet is a place to fill (16 at most). The cursor goes to the first; when you have typed it, Tab goes to the next one. In C, if and Tab puts the cursor in the condition; Tab then goes into the block. The places follow the text as you type in them. They end at the last place, when you press Tab with the cursor outside the snippet, or in another document; then Tab works as usual again. A snippet with no %cursor% leaves the cursor at its end. A function's call, taken from the completion list, has places the same way (section 7).

Snippets on a tag

In HTML (and in PHP), a snippet can follow an opening tag. When "XML/HTML tag auto-closing" would add the closing tag after you type >, a snippet for that tag is written in its place. The key of such a snippet is the tag itself. The built-in ones, in the [HTML] section, are <table> (a header row and a row), <tr>, <ul>, <ol>, <dl>, <select> and <html> (head, title and body). For example, typing <ul> gives:

<ul>
	<li>|</li>
</ul>

Your own go in your file: <nav>=\n\t<a href="%cursor%">%cursor%</a>\n</nav> in an [HTML] section. A tag snippet is not in the completion list, and its word does nothing with Tab.

9. The Document menu

The Document menu holds the settings of the document in front: each open document has its own. A new document takes them from Preferences; a file can also have them detected (below). The check marks and radio dots of the menu always show the document in front.

☐ Line Wrapping ☐ Line Breaking ☑ Auto-indentation Indent Type ▸ Indent Width ▸ ☐ Read Only ☐ Write Unicode BOM Set Filetype... · Set Encoding ▸ · Set Line Endings ▸ Clone · Strip Trailing Spaces Replace Tabs with Spaces Replace Spaces with Tabs... Fold All · Unfold All Remove Markers · Remove Error Indicators Detect from Content ◉ Tabs ○ Spaces ○ Tabs and Spaces Detect from Content ○ 1 ○ 2 ○ 3 ◉ 4 ○ 5 ○ 6 ○ 7 ○ 8 (each number is its own item) Set Encoding, Set Line Endings and Write Unicode BOM: see Files and Recovery.
The Document menu, with the Indent Type and Indent Width flyouts open.
ItemWhat it does
Line WrappingLong lines continue on the next row instead of going past the right edge. The line itself stays one line; only its display wraps. A new document takes this from Preferences > Editor > Features > Line wrapping.
Line BreakingWhile you type, a line that grows past the long line marker's column is broken at its last space (section 6). Off for every new document.
Auto-indentationWhether Enter indents the new line. When on, the mode is Preferences' Auto-indent mode. A new document has it on, unless that mode is None.
Indent Type > Tabs / Spaces / Tabs and SpacesWhat indentation is made of. Tabs: one tab per step. Spaces: spaces only. Tabs and Spaces: a tab is 8 columns, and an indentation is as many tabs as fit, then spaces for the rest (as in old Emacs and GNU style).
Indent Type > Detect from ContentLooks at the document's indentation and sets the type it finds. The Status tab says what was set, or "Could not detect the indentation type" when the text gives no answer.
Indent Width > 1 to 8How many columns one indentation step is. It is also the width of a tab on the screen, except with Tabs and Spaces, where a tab is always 8.
Indent Width > Detect from ContentFinds the width from the document's indentation (2 to 8). It cannot tell the width of tabs, so with the type Tabs it does not change anything.
Read OnlyThe document cannot be changed, and Save and Save As refuse with "Cannot save read-only document". Switch it off again to edit.
Write Unicode BOMSee Files and Recovery.
Set Filetype...A list of the languages, with Plain Text first and each language's file patterns under its name. The choice changes the language of the document: its colors, comments, folding, completions and snippets. The status bar says "Filetype:" and the new language. See Languages.
Set Encoding, Set Line EndingsSee Files and Recovery.
CloneOpens a new, untitled document with the same text, the same filetype and Document menu settings, and the cursor in the same place. It is unsaved, so Unryu asks for a name when you save it.
Strip Trailing SpacesRemoves the spaces and tabs at the end of every line of the document.
Replace Tabs with SpacesTurns every tab of the document into spaces, up to the next tab stop, so the text looks the same. The tab stops are the document's indent width apart. With Indent Type Tabs and Spaces, where a tab shows as 8 columns, this changes how the text lines up unless the indent width is 8.
Replace Spaces with Tabs...Asks "Enter the amount of spaces which should be replaced by a tab character" (the indent width at first, 1 to 100), then, reading from left to right, turns each group of that many spaces in a row into one tab (8 spaces become two tabs when the number is 4; 5 become a tab and a space). Tab stops are not taken into account. This happens anywhere in the text, also in strings and comments, not only in the indentation.
Fold All / Unfold AllFolds or unfolds every block (section 10). Greyed when code folding is off.
Remove MarkersRemoves all bookmarks of the document (section 11).
Remove Error IndicatorsRemoves the red waves under error lines. The lines in the message window stay.

Settings kept for each file. When you change Line Wrapping, Line Breaking, Auto-indentation, Indent Type, Indent Width or Read Only for a file, Unryu remembers that choice for that file (in ~/.config/unryu/file_settings.txt) and uses it again the next time the file opens, over Preferences and detection. Settings you did not change keep following Preferences.

Detection when a file opens. With Preferences > Editor > Indentation > "Detect type from file" and "Detect width from file" (both off at first), Unryu looks at each file it opens and follows the indentation it finds; the Status tab says what it set. Very deep indentation (more than 24 columns) is taken for alignment and not counted.

A project's own indentation. A project's settings file (.unryu.conf in its folder, with indent-type and indent-width under [project]) also sets the indentation of its files: over Preferences, but under detection and under what you set for the file (see Build and Run).

Each of Strip Trailing Spaces, Replace Tabs with Spaces and Replace Spaces with Tabs is one Undo step. To have them done at every save instead, see Preferences > Files > Saving files (Files and Recovery).

10. Code folding

A fold hides the inside of a block, so that you see the shape of a long file. The fold margin, at the left of the text, has a box beside each line that starts a block: a minus when the block is open, a plus when it is folded. Click the box to fold or unfold. A folded line is underlined across the window, and the lines it hides take no room: scrolling, the cursor keys and the wheel go past them as one line.

29 30 42 43 44 typedef struct { ← lines 31 to 41 are hidden static int stopping(const Walk *walk) { return ...; + : folded; a click opens it − : open; a click folds it "} else {" stays in sight, because it starts the next block. A jump into a folded block opens it; the cursor keys step over it.
The line numbers, the fold margin, a folded block (underlined) and an open one.

The colors are the keys fold-margin and fold-marker of the editor theme (Themes).

11. Bookmarks, change history and error indicators

The markers margin is between the line numbers and the fold margin. It shows three kinds of mark on lines.

1234 numbers markers fold a line with a bookmark (Ctrl+M, or a click in the margin) a line changed and not saved yet a line changed and saved a line with a compiler error The kinds of mark bookmark: yours, an arrow change history: a bar at the right of the margin (orange, then green) error: a red wave under the line Opening or reloading a file clears all.
The margins from left to right, and what each kind of mark shows.

Bookmarks

ItemKeysWhat it does
Toggle Marker (no menu item)Ctrl+M, or a click in the markers marginPuts a bookmark on the line, or takes it off.
Search > Go to Next MarkerCtrl+.Moves the cursor to the start of the next line below the cursor with a bookmark. It does not wrap around: when there is none below, Unryu beeps (if the beep is on in Preferences > General), even if there are bookmarks above.
Search > Go to Previous MarkerCtrl+,The same, upwards. Back (Alt+Left) returns to where you were.
Set numbered bookmark (no menu item)Ctrl+Shift+0 ... Ctrl+Shift+9Puts bookmark number 0 to 9 on the cursor's line: its digit shows in the markers margin. Each number is on one line at a time: set again on another line, it moves there; on the same line, it comes off.
Go to numbered bookmark (no menu item)Ctrl+0 ... Ctrl+9Moves the cursor to that bookmark's line (to its first character after the indentation). Back returns to where you were. With no such bookmark, the status bar says so. Ctrl+0 is still View > Normal Size while bookmark 0 is on no line.
Document > Remove MarkersRemoves all bookmarks of the document.
View > Show Markers MarginShows or hides the margin. The bookmarks stay, and the keys still work. Preferences > Editor > Display > Show markers margin is the same setting (on at first).

A bookmark belongs to its line. When lines are added or removed above it, it moves with its line. When an edit removes the start of its line, it goes to the line of the edit; a numbered one too. Bookmarks are not saved with the file: they last until the document is closed or reloaded, except that a workbench keeps its files' plain bookmarks (Files). The minimap shows each bookmark's line (The Window).

Change history

Preferences > Editor > Display > Change History shows which lines you changed since the file was opened. Each line that an edit touches is "changed" (orange at first); when you save, those lines become "saved" (green at first). "Show in markers margin" draws a bar at the right of the markers margin; "Show as underline indicators" draws a line under the changed text. Both are off at first.

Error indicators

When a build (Build and Run) or the compiler check (Navigate > Suggest Repairs) reports a problem on a line of an open file (for a build: an error or a warning; for the compiler check: an error), Unryu draws a red wave under that line. Each new build removes the old waves first. Document > Remove Error Indicators removes them by hand. Preferences > Editor > Features > "Use indicators to show compile errors" (on at first) switches them off; the errors are still listed in the message window.

The colors are keys of the editor theme: marker-margin, marker, change-modified, change-saved and error-indicator (Themes).

12. Drag and drop, block selection and virtual space

WhatHow it works
Drag and drop of textPress in the selection and drag: the text moves to where you let go. Hold Ctrl when you let go to copy it instead. While you drag, the cursor shows where the text will go, a tag with the start of the text follows the pointer, and the pointer shows a move shape (a plus sign with Ctrl). A click in the selection without a drag just places the cursor. Letting go inside the selection itself moves nothing. After the drop, the text is selected in its new place. The move is one Undo step. Preferences > Editor > Features > Disable Drag and Drop switches it off.
Block (rectangular) selectionHold Alt and drag, or press Alt+Shift with the arrow keys, to select a block of columns across several lines (a tab counts up to its tab stop). Typing then replaces the block on every line and leaves a cursor on each line, so you can go on typing in all of them at once. Tab puts a tab on every line. BackSpace and Delete work on every line. Ctrl+C and Ctrl+X copy or cut the block: the selected columns of each line, one line under the other. Edit > Format > Shift Column Left and Right move the block's text one column at a time. Escape, a click, or any other key (a move, Enter, Paste) ends the block. Block selection does not work while Line Wrapping is on or while any block is folded.
Virtual spacePreferences > Editor > Features > Virtual spaces. "Only for rectangular selections" (the default): a block can reach past the ends of short lines, and typing there fills those lines with spaces. "Always": the cursor can also go past the end of any line (by a click there, or Right at the end of the line); Up and Down keep the column, and typing there fills the line with spaces first. "Disabled": neither. "Always" does not work while Line Wrapping is on or while any block is folded.

Go to Anything, the Command Palette

Navigate > Go to Anything (Ctrl+Alt+O) opens a small window: a field above a list. Type part of what you want and the list keeps what matches, the best first; the letters need only be in order, not next to each other (drc finds src/draw.c, sws finds Show White Space). The arrows, Page Up and Page Down move in the list as you type; Enter takes the row, a double click too; Escape closes it. The first character you type says what the list holds:

Typed firstThe listTaking a row
(anything else)The open documents and every file of the project (from the project index, Code analysis)Opens the file, or brings its tab to the front
>Every command of Preferences > Keybindings, with its keys; Navigate > Command Palette (Ctrl+Shift+P) opens with it typedRuns the command
@What this document defines: functions, types, macros, file-level variables, with their linesGoes there
#What the whole project defines, in every language, with the file and line; Navigate > Go to Symbol in the Project (Ctrl+Alt+G) opens with it typedOpens the file there
: and a numberNothingGoes to that line

Navigate > Switch Header and Source (Ctrl+Alt+H) goes from draw.c to draw.h and back: the file of the same name and the other kind beside it, else the one in the project with the most of its path in common (from the project index). When the cursor is in a function, it lands on that function in the other file: its declaration in the header, its body in the source file. The status bar says when there is no such file.

ItemKeysWhat it does
Search > Go to Line...Ctrl+LAsks "Enter the line you want to go to:" and goes there. +N goes N lines down from the cursor and -N N lines up. A number past the end goes to the last line. The field takes only digits and one + or - at the start, and it remembers the last line you entered. The toolbar's line field and Go to Line button do the same.
Navigate > BackAlt+LeftGoes back to the place you jumped from.
Navigate > ForwardAlt+RightGoes forward again, after Back.
Navigate > Go to PartnerCtrl+BWith the cursor at a brace, a quote, a tag, a block word or an #if line, goes to the other end of its pair. See Code analysis.
Navigate > Select Inside Pair, Select PairCtrl+Alt+B, Ctrl+Alt+Shift+BSelect what is inside the pair around the cursor, or the pair with its ends; again, the next pair out. Only certain pairs. See Code analysis.
Navigate > Go to DefinitionCtrl+T, F12, Ctrl+clickGoes to where the name at the cursor is defined, or opens the header an #include names. In Markdown, follows the link at the cursor. See Code analysis.
Go to Symbol Declaration (Search > More)Ctrl+Shift+TGoes to where the name is declared, for example a function's prototype before its body.
Navigate > Next / Previous Doubtful BraceCtrl+Alt+Down / Ctrl+Alt+UpGoes to the next or previous brace whose partner Unryu is not sure of. See Code analysis.
Navigate > Insert Missing BraceCtrl+Shift+JPuts in the brace, quote, end tag or closing word that Unryu shows as missing. See Code analysis.
Navigate > Suggest Repairs (Runs the Compiler)Ctrl+Shift+BSee Build and Run.
Search > Go to Next / Previous MarkerCtrl+. / Ctrl+,See section 11.

Back and Forward

Each jump remembers the place it leaves and the place it arrives at, so Back can take you there again. A jump is: Go to Line, Go to Definition and Declaration, a click on a line in the message window (search results, build errors), a click in the sidebar's symbol list or files list, Go to Next / Previous Marker, Open Selected File, a link in Details or in a tooltip, and a Markdown link. Moving the cursor with the keys or a click is not a jump.

a.c line 10 a.c line 200 b.h line 31 a.c line 50 ← Back (Alt+Left) Forward (Alt+Right) → where you are now Forward goes here; a new jump removes it The list holds up to 256 places. A place in a file that is no longer open is skipped and removed.
Back and Forward walk through the places of your jumps. A new jump after Back removes the places ahead.

Only files with a name are kept in the list; an untitled document has no places in it.

14. The Tools menu

ItemWhat it does
MacrosRecord keys and play them back, and keep them as macros (below).
Color ChooserA color dialog for colors in code (below).
Word CountShows the number of lines, words and characters of the selection, or of the whole document when nothing is selected. A word is anything between spaces, tabs and line ends; a character is a Unicode character, not a byte.
Check Spelling, Spelling Word List...Marks the words that are not in the word list (below).
Translation ▸The Translation Helper, for gettext catalogs (below).
Reload Configuration, Configuration FilesRead Unryu's configuration files again, or open one of them in a tab. See Preferences.
Set Project Folder... and the other project itemsSee Build and Run.

The Translation Helper

Tools > Translation works on a gettext catalog (a .po or .pot file); it is greyed in other documents. Its items:

ItemWhat it does
Next / Previous Untranslated or FuzzyThe cursor goes into the translation of the next (or previous) message that has none yet, or is marked fuzzy. The header and obsolete messages (#~) are passed over. When there is none, the status bar says how far the catalog is.
Next / Previous Untranslated, Next / Previous FuzzyThe same, for one kind.
Next with Different Format DirectivesThe next message whose translation's format directives are not the original's (below).
Toggle FuzzyMarks the message the cursor is in as fuzzy, or takes the mark off: fuzzy goes first among its flags (#, fuzzy, c-format), or on a line of its own when it has none; a flags line left empty goes.
Copy Original into TranslationThe original takes the translation's place: msgid into msgstr, and for a plural message msgid_plural into msgstr[1] and the forms after it.
Reflow TranslationWraps the translation as gettext's tools do: on the msgstr line when it fits in 79 columns with no line break inside it, else msgstr "" and then lines of at most 79 columns, broken after a space, and after each \n.
StatisticsHow many messages are translated (and what part of all), fuzzy and untranslated, and how many have format directives that differ, in the status bar.
Update the Header's Date on SaveOn at first: when a changed catalog is saved, the header's PO-Revision-Date becomes the time of the save.

Format directives. Kami checks each translation's format directives against the original's: %s, %d, %5.2f, %ld, %1$s. The translation must have the same ones, of the same kinds: numbered ones (%2$s ... %1$d) may come in any order; a plural form may leave out the number ("un fichier" for "%d files"). A translation whose directives differ gets a red wave under it, and the program that shows it would print the wrong thing or crash. The check is made for c-format and python-format messages, and for messages that say nothing when either text has a directive; a no-c-format one is left alone.

The next untranslated or fuzzy message, Toggle Fuzzy and Copy Original have key actions (Tools, Translation: ...) with no keys at first: give them keys in Preferences > Keybindings.

Check Spelling

With Tools > Check Spelling on (it is on at first), each word that is not in the word list gets a red wave under it. Only words are checked, not code:

A word is letters (Latin, Greek and Cyrillic ones too), with an apostrophe between two of them (don't, don’t). Words that are part of a name of code are left alone: with a digit or _ (word_count), with a capital past the first letter (wordCount, HTML), in a dotted name or a path (file.txt, src/main), in a web address, and right after \, %, @, #, $ or & (\textbf, %s, @param). A word of one letter is not checked. A word that is in the list in small letters is right with a capital first (the start of a sentence); a name that is in the list with its capital (Paris) needs it. A possessive of a known word (dog's) is right.

Right-click a marked word for its suggestions (up to five, the likeliest first: two letters swapped, one changed, one left out or added, or the word split in two); choosing one puts it in place of the word. Add to Dictionary keeps the word in words.txt in Unryu's configuration folder, a word a line, which you can edit. Ignore All takes the word as right until Unryu quits.

The word list is /usr/share/dict/words at first: American English on most systems (the wamerican package on Debian). Tools > Spelling Word List... chooses another file with a word a line, such as another language's list; lines that start with # are left out. If the list cannot be read, the status bar says so and nothing is marked.

The Color Chooser

Put the cursor on a color in the text, such as #3a7, #33aa77 or 0x33aa77, or select it, and choose Tools > Color Chooser. The dialog starts at that color. Pick a new one and press OK: it replaces the color in the text. When the cursor is not on a color, the new color goes in at the cursor. A color in one of the forms below (rgb(), hsl(), SDL_Color) is written back in its own form; another goes in in the Format chosen in the dialog.

Colors in the text

Rest the pointer on a color in the text, and the popup shows a swatch of it, with the color as written, as #rrggbb and as rgb(). Only colors that are certainly colors count:

The swatch is a real one: a color with its alpha shows over a checkerboard, and its border stands out from both the color and the popup. Drag it onto another color in the text, and that color becomes this one, written in its own form (an rgb() stays an rgb(), #ABC stays three capital digits when it can). One Undo step takes it back. Ctrl+click on a color opens the Color Chooser at it (instead of Go to Definition), and OK writes the new color in its place, in its own form. The text never moves to make room for a swatch: the swatch is in the popup.

Macros: recording keys

A macro is a run of keys you record once and play as often as you like: the same change on many lines, for example.

ItemKeysWhat it does
Tools > Macros > Start Recording, Stop RecordingCtrl+Alt+RStarts keeping every key you press in the editor: the text you type, the moves, the editing keys (Ctrl+D, Ctrl+K ...). Press it again to stop. The status bar says how many steps were kept.
Play Last RecordingCtrl+Alt+MPlays the last recording at the cursor, as if you pressed the keys again: the typing help (auto-indent, auto-close ...) works as it does when you type.
Save Last Recording...Asks for a name and keeps the recording in macros.conf, where it stays between sessions. The saved macros are listed below it in the menu: choose one to play it.
Edit MacrosOpens macros.conf in a tab. Edit it as any text and save: Unryu reads it again.

In macros.conf each macro is its name in square brackets, then key = the keys that play it (written as in Keybindings, such as Ctrl+Alt+1; empty for none) and steps = its keys: names such as Home, Shift+End, Ctrl+c and Return, and typed text in double quotes (\" for a quote inside):

[Quote the line]
key = Ctrl+Alt+1
steps = Home "> " Down

Only keys pressed in the editor are recorded; a click is not. A key that this keyboard does not have is left out when the macro plays, and the status bar says so; a character that no key gives is put in as it is.

15. Underlined letters in menus and dialogs

In the menu bar, Alt and the first letter of a menu's name opens that menu (Alt+F for File, Alt+E for Edit), wherever the keyboard is. In an open menu, each item's first letter is underlined: press it to choose the item. When two items start with the same letter, the first one is chosen.

In dialogs, a button, check box or field with an underlined letter is reached with Alt and that letter. The underline goes on the letter in this order:

Rule, in this orderExample
1. The first place where the letter starts a wordUse escape sequences (Alt+E)
2. Else the first place after the first wordMatch from start of word (Alt+T); Replace with (Alt+H)
3. Else the first place at allCase sensitive (Alt+A)

16. Editing settings in Preferences

All of these are in Preferences > Editor (Preferences). The value in brackets is the one Unryu starts with.

TabSettingWhat it does
FeaturesLine wrapping (off)Line Wrapping for new documents (section 9).
"Smart" home key (on)Home goes to the first character that is not a space, then to column 1.
Disable Drag and Drop (off)Selected text cannot be dragged.
Code folding (on), Fold/unfold all children of a fold point (off)See section 10.
Use indicators to show compile errors (on)Red waves under error lines (section 11).
Newline strips trailing spaces (off)Enter removes the spaces at the end of the line you leave.
Keep the backslashes of a #define lined up (on)See section 6.
Comment toggle marker (~ )What Toggle Line Commentation adds after the comment sign.
Virtual spaces (Only for rectangular selections)See section 12.
IndentationWidth (4)The indent width of new documents, 1 to 16.
Auto-indent mode (Current chars)See section 6.
Type (Tabs)Tabs, Spaces, or Tabs and spaces, for new documents.
Detect type from file (off), Detect width from file (off)Follow the indentation of each file that opens.
Tab key indents (on)Tab in the indentation goes to the next step. Off: Tab always puts a tab character (or, with the type Spaces, spaces).
Backspace key unindents (on)BackSpace in the indentation removes a whole step.
CompletionsSnippet completion (on), XML/HTML tag auto-closing (on)See sections 8 and 6.
Automatic continuation of multi-line comments (on)Enter in a /* */ comment adds the *.
Autocomplete symbols (on), Autocomplete all words in document (off), Drop rest of word on completion (off), Write a function as a call, a place for each parameter (on)See section 7.
Max. symbol name suggestions (30), Completion list height (10), Characters to type for autocompletion (4), Symbol list update frequency (250)See section 7.
Auto-close quotes and brackets: Parenthesis ( ), Curly brackets { }, Square brackets [ ], Single quotes ' ', Double quotes " " (all off)Each one adds its closing character where it is wanted (Auto-close).
DisplayShow markers margin (on); Long line marker > Column (72); Change History (off)See section 11. The long line column is also the column of Reflow and Line Breaking. The other Display settings are explained in Preferences.

The keys of the commands on this page are fixed. Preferences > Keybindings can change the keys of the menu items it lists (such as Undo, Redo, Go to Line and the Document items), but not of the line and format commands such as Ctrl+D, Ctrl+E or Ctrl+J.