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+w
forwrap
.Type
if
followed byTab
to insert theif
snippet.Fill in the condition.
Tab to the body.
Press
Alt+i
to insert the original selection.Optionally, press
Alt+o
to move the cursor to the end of theif
snippet. This works even if the snippet doesn’t have an explicit@$
tabstop at the end.