1

I have set up a macro for Smarty in Komodo Edit which adds a {$|@dumpr} when I press my specified key binding (which, for info is Ctrl+Alt+P).

What I would like is the cursor to be automatically inserted between the $ and the | so I can type my variable name without having to manually navigate my way in there.

Any help?

Many thanks.

davo0105
  • 117
  • 8

1 Answers1

1

Use the currentPos and gotoPos methods:

komodo.assertMacroVersion(2);
if (komodo.view && komodo.view.scintilla) { komodo.view.scintilla.focus(); } // bug 67103

var currentPos = komodo.editor.currentPos;
komodo.editor.insertText(currentPos, '{$|@dumpr}');
komodo.editor.gotoPos(currentPos+2);
Paul Sweatte
  • 24,148
  • 7
  • 127
  • 265