AST Clipboard

The AST clipboard is a dedicated clipboard for use with AST editing commands such as wrap. Selections that are cut and may need to be re-inserted elsewhere, potentially with some intermediate steps beforehand, are placed into this clipboard.

To insert the contents of the AST clipboard, press Alt+i. This replaces the selected lines with the clipboard contents.

Example

AST mode and normal mode can coordinate via the AST clipboard and snippets in order to implement multi-step edits. For example, to wrap the selection in an if statement:

  1. From normal mode, select the code to wrap and press Esc+w for wrap.

  2. Type if followed by Tab to insert the if snippet.

  3. Fill in the condition.

  4. Tab to the body.

  5. Press Alt+i to insert the original selection.

  6. Optionally, press Alt+o to move the cursor to the end of the if snippet. This works even if the snippet doesn’t have an explicit @$ tabstop at the end.