Editing

Drag and drop of text

If you drag selected text in the editor widget of Geany the text is moved to the position where the mouse pointer is when releasing the mouse button. Holding Control when releasing the mouse button will copy the text instead. This behaviour was changed in Geany 0.11 - before the selected text was copied to the new position.

Auto indentation

Geany knows three types of auto indentation: None, Basic and Advanced.

Auto indentation types

None

Disables auto indentation completely.

Basic

Adds the same amount of whitespace on a new line as on the last line.

Advanced

Does the same as Basic but also indents curly brackets and adds a tabulator character (or spaces) on a new line after an opening '{' brace.

Construct completion

Built-in construct completion is available for C-like languages. By default the Tab key is used straight after typing the construct keyword.

Example: for<TAB>

typed into a C file expands to:

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

}

Bookmarks

Geany provides a handy bookmarking feature that lets you mark one or more lines in a document, and return the cursor to them using a key combination.

To place a mark on a line, either left-mouse-click in the left margin of the editor window, or else use Ctrl-m. Either way, this will produce a small green plus symbol in the margin. You can have as many marks in a document as you like. Click again (or use Ctrl-m again) to remove the bookmark. To remove all the marks in a given document, use "Remove Markers" in the Document menu.

To navigate down your document, jumping from one mark to the next, use Ctrl-. (control period). To go in the opposite direction on the page, use Ctrl-, (control comma). Using the bookmarking feature together with the commands to switch from one editor tab to another (Ctrl-PgUp/PgDn and Ctrl-Tab) provides a particularly fast way to navigate around multiple files.

Send text through definable commands

You can define several custom commands in Geany and send the current selection to one of these commands. The output of the command will be used to replace the current selection. So, it is possible to use text formatting tools with Geany in a general way. The selected text will be sent to the standard input of the executed command, so the command should be able to read from it and it should print all results to its standard output which will be read by Geany. To help finding errors in executing the command, the output of the program's standard error will be printed on Geany's standard output.

To add a custom command, just go to the Set Custom Commands dialog in the Format sub menu of the Edit and Popup menu. Then click on Add to get a new text entry and type the command. You can also specify some command line options. To delete a command, just clear the text entry and press Ok. It will be deleted automatically.

Context actions

You can execute a specified command on the current word near the cursor position or an available selection and this word is passed as an argument to this command. It can be used for example to open some API documentation in a browser window or open any other external program. To do this, there is an menu entry in the popup menu of the editor widget and also a keyboard shortcut(see the section called “Keybindings”).

The command can be specified in the preferences dialog and additionally for each filetype (see "context_action_cmd" in the section called “Format”). At executing, the filetype specific command is used if available otherwise the command specified in the preferences dialog is executed.

The passed word can be referred with the wildcard "%s" everywhere in the command, before executing it will be replaced by the current word. For example, the command to open the PHP API documentation would be:

firefox "http://www.php.net/%s"

when executing the command, the %s is substituted by the word near the cursor position or by the current selection. If the cursor is at the word "echo", a browser window will open(assumed your browser is called firefox) and it will open the address: http://www.php.net/echo.