Editing Text

How to edit user defined text content within Stroom.

Stroom uses the Ace text editor for editing and viewing text, such as XSLTs, raw data, cooked events, stepping, etc. The editor provides various useful features:

Keyboard shortcuts

See Keyboard Shortcuts for details of the keyboard shortcuts available when using the Ace editor.

Vim key bindings

If you are familiar with the Vi/Vim text editors then it is possible to enable Vim key bindings in Stroom. This can be done in two ways.

Either globally by setting Editor Key Bindings to Vim in your user preferences:

User
Preferences

Or within an editor using the context menu. This latter option allows you to temporarily change your bindings.

The Ace editor does not support all features of Vim however the core navigation/editing key bindings are present. The key supported features of Vim are:

  • Visual mode and visual block mode.
  • Searching with / (javascript flavour regex)
  • Search/replace with commands like :%s/foo/bar/g
  • Incrementing/decrementing numbers with Ctrl ^ + a / Ctrl ^ + b
  • Code (un-)folding with z , o , z , c , etc.
  • Text objects, e.g. >, ), ], ', ", p paragraph, w word.
  • Repetition with the . command.
  • Jumping to a line with :<line no>.

Notable features not supported by the Ace editor:

  • The following text objects are not supported
    • b - Braces, i.e { or [.
    • t - Tags, i.e. XML tags <value>.
    • s - Sentence.
  • The g command mode command, i.e. :g/foo/d
  • Splits

For a list of useful Vim key bindings see this cheat sheet , though not all bindings will be available in Stroom’s Ace editor.

Use of Esc key in Vim mode

The Esc key is bound to the close action in Stroom, so pressing Esc will typically close a popup, dialog, selection box, etc. Dialogs will not be closed if the Ace editor has focus but as Esc is used so frequently with Vim bindings it may be advisable to use an alternative key to exit insert mode to avoid accidental closure. You can use the standard Vim binding of Ctrl ^ + [ or the custom binding of k , b as alternatives to Esc .

Auto-Completion And Snippets

The editor supports a number of different types of auto-completion of text. Completion suggestions are triggered by the following mechanisms:

  • Ctrl ^ + Space ␣ - when live auto-complete is disabled.
  • Typing - when live auto-complete is enabled.

When completion suggestions are triggered the follow types of completion may be available depending on the text being edited.

  • Local - any word/token found in the existing document. Useful if you have typed a long word and need to type it again.
  • Keyword - A word/token that has been defined in the syntax highlighting rules for the text type, i.e. function is a keyword when editing Javascript.
  • Snippet - A block of text that has been defined as a snippet for the editor mode (XML, Javascript, etc.).

Snippets

Snippets allow you to quickly enter pre-defined blocks of common text into the editor. For example when editing an XSLT you may want to insert a call-template with parameters. To do this using snippets you can do the following:

  • Type call then hit Ctrl ^ + Space ␣ .

  • In the list of options use the cursor keys to select call-template with-param then hit Enter ↵ or Tab ↹ to insert the snippet. The snippet will look like

    <xsl:call-template name="template">
      <xsl:with-param name="param"></xsl:with-param>
    </xsl:call-template>
    
  • The cursor will be positioned on the first tab stop (the template name) with the tab stop text selected.

  • At this point you can type in your template name, e.g. MyTemplate, then hit Tab ↹ to advance to the next tab stop (the param name)

  • Now type the name of the param, e.g. MyParam, then hit Tab ↹ to advance to the last tab stop positioned within the <with-param> ready to enter the param value.

Snippets can be disabled from the list of suggestions by selecting the option in the editor context menu.

Tab triggers

Some snippets can be triggered by typing an abbreviation and then hitting Tab ↹ to insert the snippet. This mechanism is faster than hitting Ctrl ^ + Space ␣ and selecting the snippet, if you can remember the snippet tab trigger abbreviations.

Available snippets

For a list of the available completion snippets see the Completion Snippet Reference.

Theme

The editor has a number of different themes that control what colours are used for the different elements in syntax highlighted text. The theme can be set User Preferences, from the main menu , select:

User
Preferences

The list of themes available match the main Stroom theme, i.e. dark Ace editor themes for a dark Stroom theme.

Last modified November 1, 2024: Merge branch '7.3' into 7.4 (98246aa)