Advanced Find & Replace / Text Expand / Macros

前端 未结 2 1217
名媛妹妹
名媛妹妹 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:08

    You can do that in Komode.

    1. Go to "Edit" ( in top menu), "Find".
    2. Will open a window, check the chackbox "Replace" (or others that you need)
    3. Complete the text fields "find what" and "replace with", them click "Replace All"

    Just it!

    0 讨论(0)
  • 2021-01-25 07:14

    Use a snippet like this named 'ListLink':

    <li><a href="/contact-details.html?location=[[%W]]">[[%W]]</a></li>
    

    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++;
      }
    
    0 讨论(0)
提交回复
热议问题