Selection & Cursor
AST mode selections consist of zero or more whole lines. The “cursor” in AST mode only appears when dragging and dropping, and is referred to as the insert cursor. An insert cursor drops the selection either between two lines or onto a blank line, with different spacing behaviour in each case.
Note: zero-line selections occur in empty files and after deleting the current selection, but are not used for editing purposes.
Valid selections
AST mode selections always cover whole lines or “blocks” of code — you can’t select half of an if
statement, function, or HTML element for example.
Moving the selection
Using the mouse
To select a line, you can click anywhere on it. If necessary, the selection will expand to include the whole block (see Valid selections above).
Using the keyboard
The following commands move the selection:
j
: go to the next linek
: go to the previous lined
: go to the first child of the selected blocks
: go to the parent of the selected line or block
Setting the selection from normal mode
It is often useful to pre-set the desired AST selection from normal mode, for example when peeking into AST mode to quickly move several lines of code.
When switching to AST mode from normal mode, the AST selection will be initialised to cover all the lines covered by the normal mode selection (even those only partially selected). This allows you to draw “rough” selections in normal mode and then manipulate the lines in AST mode.