开发者

Inserting cursor in middle of Komodo Edit macro

I have set up a macro for Smarty in Komodo Edit which adds开发者_JAVA技巧 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.


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);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜