Features
This is a quick summary of the main features implemented so far – see the Intro post for more in-depth explanations.
Tree mode
Tree mode is a new mode where the selection is one or more lines as opposed to a string of characters. You get to it by pressing the mode switch key, which defaults to Escape (this works best if mapped under the physical Caps Lock key).
You can either hold the mode switch key (like a modifier key) to issue some quick keyboard commands or mouse gestures in tree mode, or press and release it to toggle between modes for longer sequences of commands.
In tree mode, the keyboard navigates and manipulates a simplified version of the syntax tree of the code, and the mouse selects and manipulates the nodes.
Keyboard navigation
As in vi, j and k are used for up/down navigation by default. Tree mode adds s and d, for "out" and "in", which select larger and smaller blocks of code respectively.
Below is the default prefs file – scroll down for a full list of currently available key combos:
Mouse Gestures
To make a tree selection with the mouse, just point at the line you want. If the normal selection contains multiple lines, the tree selection will contain all of those lines – as long as the result is one or more valid code blocks (a quick check for this is whether the start and end lines are at the same indentation level).
Nodes can be dragged to move them around the tree, for example to move a div
into another div
. Tree selections have pick options and drop targets, which expand the vocabulary of drag-and-drop actions to express common intentions such as moving the selection to a new else
block attached to an if
statement.
Refactorings
Right-clicking a tree selection brings up a menu of applicable refactorings such as converting variable declarations to an object.
Normal mode
Normal mode works like a regular text editor. Here are some of the standard editing features implemented so far:
Find & replace
Find & replace searches in the current document, open files, or recursively in a folder. It supports:
- Standard text replacement
- Regex replacement
- JavaScript expressions with access to backreferences, e.g.
@{$1.toUpperCase()}
Snippets
Snippets support standard tabstops and JavaScript expressions, e.g. let @name = new @{titleCase($name)};
.