Advanced Find & Replace / Text Expand / Macros

前端 未结 2 1218
名媛妹妹
名媛妹妹 2021-01-25 06:30

Hopefully a nice quick one for someone. I\'m working on a project that requires a specific link being written around 400 or so locations. Each link is the same, except it has th

2条回答
  •  再見小時候
    2021-01-25 07:14

    Use a snippet like this named 'ListLink':

  • [[%W]]
  • And create a macro using the scimoz and projects APIs to move the cursor and call the snippet in a loop:

    komodo.assertMacroVersion(2);
    if (komodo.view && komodo.view.scintilla) { komodo.view.scintilla.focus(); }
    
    var i = 1;
    var len = ko.views.manager.currentView.scimoz.lineCount; /* Count lines */
    _part = ko.projects.findPart('snippet', 'ListLink', '*'); /* Find Snippet*/
    ko.views.manager.currentView.scimoz.documentStart(); /* goto first line */
    
    while (i <= len)
      {
      if (!_part) {alert("Couldn't find a snippet called 'ListLink' when executing macro."); return;}
      ko.projects.invokePart(_part); /* invoke Snippet */
      ko.views.manager.currentView.scimoz.lineDown(); /* goto next line */
      i++;
      }
    

提交回复
热议问题