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:
From normal mode, select the code to wrap and press
Esc+wforwrap.Type
iffollowed byTabto insert theifsnippet.Fill in the condition.
Tab to the body.
Press
Alt+ito insert the original selection.Optionally, press
Alt+oto move the cursor to the end of theifsnippet. This works even if the snippet doesn’t have an explicit@$tabstop at the end.