Popular JavaScript recipes tagged "komodo"http://code.activestate.com/recipes/langs/javascript/tags/komodo/2014-07-03T15:18:03-07:00ActiveState Code RecipesCSS line with px value adds a new line with rem (JavaScript) 2013-11-20T21:15:22-08:00Magnus Axelssonhttp://code.activestate.com/recipes/users/4188509/http://code.activestate.com/recipes/578769-css-line-with-px-value-adds-a-new-line-with-rem/ <p style="color: grey"> JavaScript recipe 578769 by <a href="/recipes/users/4188509/">Magnus Axelsson</a> (<a href="/recipes/tags/convert/">convert</a>, <a href="/recipes/tags/css/">css</a>, <a href="/recipes/tags/komodo/">komodo</a>, <a href="/recipes/tags/macro/">macro</a>). </p> <p>Put your cursor on a CSS line that ends with a value in px (do not select any text). Run the script and it will insert a new line there the px value is converted to a rem value. </p> <p>You need to edit the code to modify your rem base matching the one you use in your own CSS. The default value is 16.</p> <p>Example: font-size: 12px; (run the script with the cursor in this line) font-size: 0.75rem (new line added by script) </p> Komodo JS Macro - show git blame for the current editor line (JavaScript) 2013-05-28T18:59:52-07:00Philip Cooperhttp://code.activestate.com/recipes/users/4168074/http://code.activestate.com/recipes/578537-komodo-js-macro-show-git-blame-for-the-current-edi/ <p style="color: grey"> JavaScript recipe 578537 by <a href="/recipes/users/4168074/">Philip Cooper</a> (<a href="/recipes/tags/blame/">blame</a>, <a href="/recipes/tags/git/">git</a>, <a href="/recipes/tags/javascript/">javascript</a>, <a href="/recipes/tags/komodo/">komodo</a>, <a href="/recipes/tags/macro/">macro</a>, <a href="/recipes/tags/scc/">scc</a>). </p> <p>A <a href="http://www.activestate.com/komodo">Komodo</a> JavaScript macro that can show the SCC repository information for who last changed the current line in the Komodo editor - see the screenshot below.</p> <p><img src="http://community.activestate.com/files/images/svn_blame.png" alt="svn blame image" /></p> Komodo JS macro: example chess match (JavaScript) 2012-10-24T16:59:51-07:00Todd Whitemanhttp://code.activestate.com/recipes/users/2666241/http://code.activestate.com/recipes/578304-komodo-js-macro-example-chess-match/ <p style="color: grey"> JavaScript recipe 578304 by <a href="/recipes/users/2666241/">Todd Whiteman</a> (<a href="/recipes/tags/chess/">chess</a>, <a href="/recipes/tags/editor/">editor</a>, <a href="/recipes/tags/komodo/">komodo</a>, <a href="/recipes/tags/macro/">macro</a>). </p> <p>This is an example macro that will play a specific chess game (Deep Blue v's Garry Kasparov) inside the Komodo editor.</p> Komodo JS Macro: Execute JavaScript (JavaScript) 2012-05-07T13:21:30-07:00Patrick Clokehttp://code.activestate.com/recipes/users/4180275/http://code.activestate.com/recipes/578120-komodo-js-macro-execute-javascript/ <p style="color: grey"> JavaScript recipe 578120 by <a href="/recipes/users/4180275/">Patrick Cloke</a> (<a href="/recipes/tags/debug/">debug</a>, <a href="/recipes/tags/debugging/">debugging</a>, <a href="/recipes/tags/editor/">editor</a>, <a href="/recipes/tags/komodo/">komodo</a>, <a href="/recipes/tags/macro/">macro</a>). </p> <p>Executes a JavaScript file (or the selected text) and display the results in the command output window.</p> Komodo JS Macro - Copy all "Find Results 1" data into a new editor window (JavaScript) 2014-07-03T15:18:03-07:00Dave Waldhttp://code.activestate.com/recipes/users/4181625/http://code.activestate.com/recipes/578100-komodo-js-macro-copy-all-find-results-1-data-into-/ <p style="color: grey"> JavaScript recipe 578100 by <a href="/recipes/users/4181625/">Dave Wald</a> (<a href="/recipes/tags/findresults/">findresults</a>, <a href="/recipes/tags/javascript/">javascript</a>, <a href="/recipes/tags/komodo/">komodo</a>, <a href="/recipes/tags/macro/">macro</a>). Revision 5. </p> <p>Gets the Find Results Manager for the "Find Results 1" tab, if it exists. If the tab has rows in it, then copies out all the data from each row and adds it to an output buffer. Creates a new editor view (or optionally reuses the existing one) and appends the output buffer to it. Note: Be sure to see Bruno's update below, until I get it merged in. ;)</p> Komodo JS Macro: move tabs (JavaScript) 2012-04-10T17:39:47-07:00Todd Whitemanhttp://code.activestate.com/recipes/users/2666241/http://code.activestate.com/recipes/578093-komodo-js-macro-move-tabs/ <p style="color: grey"> JavaScript recipe 578093 by <a href="/recipes/users/2666241/">Todd Whiteman</a> (<a href="/recipes/tags/editor/">editor</a>, <a href="/recipes/tags/komodo/">komodo</a>, <a href="/recipes/tags/macro/">macro</a>, <a href="/recipes/tags/position/">position</a>, <a href="/recipes/tags/tabs/">tabs</a>, <a href="/recipes/tags/toddw/">toddw</a>). </p> <p>This Komodo macro is an example to show how to programmatically re-position a Komodo editor tab. This macro moves the currently selected tab to the start of the tab list.</p> Komodo JS Macro: Real auto word-wrap (JavaScript) 2012-04-10T17:38:13-07:00Furlohttp://code.activestate.com/recipes/users/4180513/http://code.activestate.com/recipes/578099-komodo-js-macro-real-auto-word-wrap/ <p style="color: grey"> JavaScript recipe 578099 by <a href="/recipes/users/4180513/">Furlo</a> (<a href="/recipes/tags/auto/">auto</a>, <a href="/recipes/tags/komodo/">komodo</a>, <a href="/recipes/tags/macro/">macro</a>, <a href="/recipes/tags/word/">word</a>, <a href="/recipes/tags/wrap/">wrap</a>). </p> <p>This script will add real auto-wrap functionality to Komodo, ie. it will wrap text after reaching column 80 just in the same way as you would by pressing &lt;Enter&gt;.</p> <p>You can bind a keyboard shortcut to macro, or trigger it on Komodo startup, or both. Either way, repeated pressing of binded shortcut (or running the macro) will switch it off and on again.</p> <p>In fact, script only adds event listener, which fires a function (after each keypress), that checks if cursor position is not in column higher that 79 and, if needed, calls Komodo built-in function "Reflow paragraph" to reflow the paragraph.</p> <p>This recipe was not created by me from scratch. I have just read David Brewer's feature request at <a href="http://code.activestate.com/lists/komodo-discuss/4965/">komodo-discuss</a>, used <a href="http://www.openkomodo.com/blogs/troyt/revenge-auto-wrap-type-type-type-ding">troyt's original code</a> for autowrap and tweaked/simplified it a little.</p> Komodo Macro: stop leaving indented blank lines when you press enter (JavaScript) 2012-03-09T19:28:31-08:00Raymond Butcherhttp://code.activestate.com/recipes/users/4181141/http://code.activestate.com/recipes/578068-komodo-macro-stop-leaving-indented-blank-lines-whe/ <p style="color: grey"> JavaScript recipe 578068 by <a href="/recipes/users/4181141/">Raymond Butcher</a> (<a href="/recipes/tags/komodo/">komodo</a>, <a href="/recipes/tags/macro/">macro</a>). </p> <p>When your cursor is at the end of an indented blank line, and you press the enter key, this macro will catch that keypress and insert an empty new line above the current line. This pushes your indented line down, and you can keep coding as normal. It is quite seamless; the only difference is that you have not left any whitespace in your wake.</p> <p>This makes it easier to follow the Python PEP-8 style guide, but it's not limited to Python code.</p> Macro to Quick find (ctrl+f3) on double click (JavaScript) 2011-07-22T07:46:26-07:00Adamhttp://code.activestate.com/recipes/users/4173315/http://code.activestate.com/recipes/577801-macro-to-quick-find-ctrlf3-on-double-click/ <p style="color: grey"> JavaScript recipe 577801 by <a href="/recipes/users/4173315/">Adam</a> (<a href="/recipes/tags/editor/">editor</a>, <a href="/recipes/tags/javascript/">javascript</a>, <a href="/recipes/tags/komodo/">komodo</a>, <a href="/recipes/tags/macro/">macro</a>, <a href="/recipes/tags/scintilla/">scintilla</a>). Revision 3. </p> <p>This does a search for the selected word when you double click it. Functionality similar to Notepad++. Faster that ctrl-f3.</p> Komodo JS Macro: smart quotes and smart braces (JavaScript) 2013-06-24T13:38:55-07:00Todd Whitemanhttp://code.activestate.com/recipes/users/2666241/http://code.activestate.com/recipes/577790-komodo-js-macro-smart-quotes-and-smart-braces/ <p style="color: grey"> JavaScript recipe 577790 by <a href="/recipes/users/2666241/">Todd Whiteman</a> (<a href="/recipes/tags/braces/">braces</a>, <a href="/recipes/tags/brackets/">brackets</a>, <a href="/recipes/tags/komodo/">komodo</a>, <a href="/recipes/tags/macro/">macro</a>, <a href="/recipes/tags/scintilla/">scintilla</a>, <a href="/recipes/tags/smart/">smart</a>, <a href="/recipes/tags/toddw/">toddw</a>). Revision 5. </p> <p>With this macro, you can make a text/word selection, then press one of ", ', (, [ or { and the matching set of quotes/braces will be added around the selection.</p> <p>Example (where | denotes the selection): This is |myselectedword|. then pressing "{" you'll get: This is {myselectedword}.</p> Komodo JS Macro: colorize the output console with a different color scheme (JavaScript) 2011-06-24T17:52:48-07:00Todd Whitemanhttp://code.activestate.com/recipes/users/2666241/http://code.activestate.com/recipes/577770-komodo-js-macro-colorize-the-output-console-with-a/ <p style="color: grey"> JavaScript recipe 577770 by <a href="/recipes/users/2666241/">Todd Whiteman</a> (<a href="/recipes/tags/color/">color</a>, <a href="/recipes/tags/komodo/">komodo</a>, <a href="/recipes/tags/macro/">macro</a>, <a href="/recipes/tags/scintilla/">scintilla</a>, <a href="/recipes/tags/toddw/">toddw</a>). </p> <p>It's possible to colorize any Scintilla based widget (the editor part) in Komodo using a color scheme. In Komodo there is the "Fonts and Color" preferences that get applied to all scintilla widgets, but you can manually change individual scintilla widgets as you wish.</p> <p>This macro changes the color scheme of the Command Output tab to use the "Dark" scheme.</p> Komodo JavaScript Macro - wrap the current word under the cursor (JavaScript) 2011-02-02T23:28:37-08:00Todd Whitemanhttp://code.activestate.com/recipes/users/2666241/http://code.activestate.com/recipes/577561-komodo-javascript-macro-wrap-the-current-word-unde/ <p style="color: grey"> JavaScript recipe 577561 by <a href="/recipes/users/2666241/">Todd Whiteman</a> (<a href="/recipes/tags/komodo/">komodo</a>, <a href="/recipes/tags/macro/">macro</a>, <a href="/recipes/tags/text/">text</a>, <a href="/recipes/tags/toddw/">toddw</a>, <a href="/recipes/tags/wrap/">wrap</a>). </p> <p>A <a href="http://www.activestate.com/komodo">Komodo</a> JavaScript macro that can be used to wrap the current word under the cursor position (or current selection) with arbitrary text.</p> <p>For example, if I'm editing a HTML file and have the selected text "This is my heading", I can quickly use this macro to wrap this text into "&lt;h1&gt;This is my heading&lt;/h1&gt;".</p> Post code to Pastebin.com (JavaScript) 2010-12-06T17:56:41-08:00Nathan Rambeckhttp://code.activestate.com/recipes/users/4171896/http://code.activestate.com/recipes/577489-post-code-to-pastebincom/ <p style="color: grey"> JavaScript recipe 577489 by <a href="/recipes/users/4171896/">Nathan Rambeck</a> (<a href="/recipes/tags/komodo/">komodo</a>, <a href="/recipes/tags/pastebin/">pastebin</a>). </p> <p>This is an updated version of another recipe (#577170) to post selected text to <a href="http://pastebin.com" rel="nofollow">pastebin.com</a>. This version uses the latest API. You'll want to change the following variables to your preferences: email, nick, expiry.</p> Get the Name of the Current Method (JavaScript) 2011-01-03T20:49:58-08:00Eric Promislowhttp://code.activestate.com/recipes/users/4166930/http://code.activestate.com/recipes/577532-get-the-name-of-the-current-method/ <p style="color: grey"> JavaScript recipe 577532 by <a href="/recipes/users/4166930/">Eric Promislow</a> (<a href="/recipes/tags/codeintel/">codeintel</a>, <a href="/recipes/tags/komodo/">komodo</a>, <a href="/recipes/tags/sections/">sections</a>). </p> <p>Here's a snippet for Komodo JavaScript macros that gives the name of the current method</p> A Template for Crash-Resistant Toggle-Macros (JavaScript) 2010-10-07T00:51:42-07:00Eric Promislowhttp://code.activestate.com/recipes/users/4166930/http://code.activestate.com/recipes/577418-a-template-for-crash-resistant-toggle-macros/ <p style="color: grey"> JavaScript recipe 577418 by <a href="/recipes/users/4166930/">Eric Promislow</a> (<a href="/recipes/tags/komodo/">komodo</a>, <a href="/recipes/tags/macro/">macro</a>, <a href="/recipes/tags/snippet/">snippet</a>, <a href="/recipes/tags/template/">template</a>). </p> <p>If you've followed my postings here lately (<a href="http://code.activestate.com/recipes/users/4166930/" rel="nofollow">http://code.activestate.com/recipes/users/4166930/</a>), you'll see that I've been playing with what I call "toggle macros", macros that toggle a state on and off, with different behaviors for each state. Unfortunately I found that it was easy to get Komodo to crash on shutdown. Meanwhile I wanted to build a framework to make it easier to build these.</p> <p>This recipe accomplishes both. It looks like putting a listener on a view object can trigger this crash, but so can storing a method on a view object, even with a unique name. So while I wanted to use the "view.view_closing" event, I can't, and I notice no other core Komodo code is. The template instead uses a global hash, ko.extensions.togglers, to store the code objects. And now I'm not getting a crash.</p> Komodo JS Macro - use vertical editor tabs positioned to the right (JavaScript) 2010-09-10T02:53:33-07:00Todd Whitemanhttp://code.activestate.com/recipes/users/2666241/http://code.activestate.com/recipes/577386-komodo-js-macro-use-vertical-editor-tabs-positione/ <p style="color: grey"> JavaScript recipe 577386 by <a href="/recipes/users/2666241/">Todd Whiteman</a> (<a href="/recipes/tags/javascript/">javascript</a>, <a href="/recipes/tags/komodo/">komodo</a>, <a href="/recipes/tags/layout/">layout</a>, <a href="/recipes/tags/macro/">macro</a>, <a href="/recipes/tags/tab/">tab</a>). </p> <p>A <a href="http://www.activestate.com/komodo-ide">Komodo</a> JavaScript macro that can be used to position the editor tabs on the right side and shown vertically.</p> <p>Additional layouts (left, right, up, down, vertical, horizontal) can be made with different combinations, see here for the Mozilla tabbox positioning documentation: <a href="https://developer.mozilla.org/en/XUL_Tutorial/Tabboxes#Position_of_the_tabs" rel="nofollow">https://developer.mozilla.org/en/XUL_Tutorial/Tabboxes#Position_of_the_tabs</a></p> Revisiting "Revenge of the auto-wrap": Another toggle-macro (JavaScript) 2010-10-04T23:51:41-07:00Eric Promislowhttp://code.activestate.com/recipes/users/4166930/http://code.activestate.com/recipes/577417-revisiting-revenge-of-the-auto-wrap-another-toggle/ <p style="color: grey"> JavaScript recipe 577417 by <a href="/recipes/users/4166930/">Eric Promislow</a> (<a href="/recipes/tags/autowrap/">autowrap</a>, <a href="/recipes/tags/javascript/">javascript</a>, <a href="/recipes/tags/komodo/">komodo</a>, <a href="/recipes/tags/togglemacro/">togglemacro</a>). Revision 2. </p> <p>Komodo doesn't automatically wrap lines when they reach a certain length, which is a good trait to have in a code editor. However, for those times where you're editing non-code, it can be helpful to have newlines inserted automatically. Troy Topnik addressed this problem a couple of years ago, in his post <a href="http://www.activestate.com/blog/2008/11/revenge-auto-wrap-type-type-type-ding" rel="nofollow">http://www.activestate.com/blog/2008/11/revenge-auto-wrap-type-type-type-ding</a> . As Komodo 6 heads out the door, I've been writing blog posts, and found this feature useful. But his solution used two macros. I put my coding hat back on, and reimplemented it as a "toggle macro".</p> Implementing Vertical Editing in Komodo 6 (JavaScript) 2010-09-29T19:09:35-07:00Eric Promislowhttp://code.activestate.com/recipes/users/4166930/http://code.activestate.com/recipes/577406-implementing-vertical-editing-in-komodo-6/ <p style="color: grey"> JavaScript recipe 577406 by <a href="/recipes/users/4166930/">Eric Promislow</a> (<a href="/recipes/tags/columns/">columns</a>, <a href="/recipes/tags/komodo/">komodo</a>, <a href="/recipes/tags/verticalediting/">verticalediting</a>). Revision 4. </p> <p>When editing a group of similar lines, it's very convenient to be able to press down-arrow and move to the same starting column position on the next line. (See an example at <a href="http://community.activestate.com/forum/vertical-editing" rel="nofollow">http://community.activestate.com/forum/vertical-editing</a> ).</p> <p>This code is for a Komodo 6 macro -- possibly the only tweak necessary to make it work on Komodo 5 is by commenting out the "macro.save()" code, but I haven't tested it. The discussion below will talk about how to use it. </p> Komodo: avoid tab-buildup with a find-alternate-file macro (JavaScript) 2010-09-28T18:16:42-07:00Eric Promislowhttp://code.activestate.com/recipes/users/4166930/http://code.activestate.com/recipes/577412-komodo-avoid-tab-buildup-with-a-find-alternate-fil/ <p style="color: grey"> JavaScript recipe 577412 by <a href="/recipes/users/4166930/">Eric Promislow</a> (<a href="/recipes/tags/find_alternate_file/">find_alternate_file</a>, <a href="/recipes/tags/komodo/">komodo</a>). </p> <p>In Emacs I used to use find-alternate-file all the time to replace the current buffer with a different one, usually one in the same directory. Komodo doesn't provide an off-the-shelf way to do this, and if you can't be bothered to close buffers when you no longer need them, you'll soon suffer from the dreaded tab buildup problem, up there with the heartbreak of browser tab overload. But it's easy to write a macro to avoid this. </p> Komodo JS Macro - delete marked lines (JavaScript) 2010-08-30T17:32:24-07:00Eric Promislowhttp://code.activestate.com/recipes/users/4166930/http://code.activestate.com/recipes/577378-komodo-js-macro-delete-marked-lines/ <p style="color: grey"> JavaScript recipe 577378 by <a href="/recipes/users/4166930/">Eric Promislow</a> (<a href="/recipes/tags/bookmarks/">bookmarks</a>, <a href="/recipes/tags/editor/">editor</a>, <a href="/recipes/tags/javascript/">javascript</a>, <a href="/recipes/tags/komodo/">komodo</a>). </p> <p>You can set bookmarks in Komodo, for ease ni revisiting certain lines. This recipe lets you delete all the marked lines in the current buffer. This code is undoable, but the markers are gone for good. They aren't restored by Scintilla, and having Komodo restore them would be a pain.</p>