Skip to content

Commit ec73242

Browse files
ctruedenclaude
andcommitted
Add vim macro recording and playback
q{register} records keys into a register, and @{register} plays them back, with a count, @@ for the last macro, @: for the last ex command, and @+ for the clipboard. Playback stops at the first failing command, so 100@a and recursive macros work as in vim. Insert mode keys from macros and '.' are now typed into the text area as key events, so that auto-indentation etc. behave as when recorded. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent c3c9caf commit ec73242

3 files changed

Lines changed: 373 additions & 42 deletions

File tree

‎src/main/java/org/scijava/ui/swing/script/EditorPane.java‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,9 @@ public void hyperlinkUpdate(final HyperlinkEvent hle) {
179179

180180
//NB: Loading of preferences will happen by calling #loadPreferences();
181181

182+
// Let vim macros type into this pane as if typed by the user.
183+
vim.setKeyDispatcher(e -> super.processKeyEvent(e));
184+
182185
// Register recordable actions: TODO this should go to EditorPaneActions
183186
getActionMap().put(EditorPaneActions.nextWordAction, wordMovement("Next-Word-Action", +1, false));
184187
getActionMap().put(EditorPaneActions.selectionNextWordAction, wordMovement("Next-Word-Select-Action", +1, true));

0 commit comments

Comments
 (0)