Duplicate Line/Selection in Komodo 5

Update: Trent from ActiveState (developers of Komodo) notified me that they’ve actually just completed this feature within the latest nightly builds. More information here.

Exploring the ability to create macros and bind them to key commands in Komodo IDE. I’m reposting the below macro that duplicates the lines or the current selection. Thus functionality was previously is Zend Studio 5, went missing from 6, and thanks to the macro, is available in Komodo. Enjoy!

// Duplicate Line or Duplicate Selection
komodo.assertMacroVersion(2);
if (komodo.view) { komodo.view.setFocus() };

var ke = komodo.editor;

if (ko.views.manager.currentView.scimoz.selText){
    // Copy the current selection
    new_selection = komodo.interpolate('%s');
    var pos = ke.currentPos;
    ke.insertText(pos,new_selection);
}else {
    ke.lineDuplicate();
}

No related posts.

No Comments »

No comments yet.

RSS feed for comments on this post.

Leave a comment