Welcome, guest | Sign In | My Account | Store | Cart

Search word under cursor (no need to select it). If no word it is possible to determine (eg. cursor is near a bracket) search by the last used find pattern

JavaScript, 21 lines
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
// Macro recorded on Tue Oct 30 2007 17:51:45 GMT+0100 (CET)
komodo.assertMacroVersion(2);
if (komodo.view) { komodo.view.setFocus() };
var searchText = komodo.editor.selText;
if (!searchText.length) {
    // if we are under a word use it
    var scimoz = ko.views.manager.currentView.scimoz;
    searchText = ko.interpolate.getWordUnderCursor(scimoz);
    if (!searchText.length) {
        // use last pattern used
        searchText = ko.mru.get("find-patternMru");
    }
}

// Search with last user find preferences
var findSvc = Components.classes["@activestate.com/koFindService;1"]
            .getService(Components.interfaces.koIFindService);
var context = Components.classes["@activestate.com/koFindContext;1"]
            .createInstance(Components.interfaces.koIFindContext);
context.type = findSvc.options.preferredContextType;
Find_FindNext(window, context, searchText);
Created by Davide Ficano on Tue, 30 Mar 2010 (GPL)
JavaScript recipes (69)
Davide Ficano's recipes (4)
Komodo Macros (15)

Required Modules

  • (none specified)

Other Information and Tasks