An interesting question came up on the Komodo community forums.
In Editor X, I’m able to make a column selection, then for each column I’m able to insert a number and have the number incremented for each subsequent row in the selection. Does Komodo support this?
First off, Komodo does not offer such a command out of the box – but we can replicate this functionality by extending Komodo.
My extension tool of choice for this will be a Komodo macro as it’s lightweight and great for user interfaces, user interactions and it will also be able to programatically control the editor.
Seeing It Work
First, in an editor file I make a rectangular selection. I used the Alt+Shift+Arrow keyboard movements, but you can also hold down Alt (Cmd on Mac, Alt on Linux) key and Mouse select the rectangular region.
then use the Tools > Insert Column Numbers menu to bring up the interface,
customize the values as necessary and press ENTER (or click OK)
which inserts the numbers as required and maintains the selection positions
allowing you to insert additional follow-on characters as required, I’ve typed “. ” which results in the final text looking like this
To install the macro simply hit the download button below, then drag the downloaded file into your Komodo toolbox.
Once in your toolbox double click the macro to activate it. The macro will
automatically activate itself the next time you start Komodo, you only need to do this manually the first time.
How Does it Work?
- DOM Inspector
- to navigate and find existing Komodo UI elements
- tweak CSS styling for the Komodo user interface
- Komodo Developer Extension
- Komodo Macro API
- to programatically interact with the Komodo editor
- Scintilla API
- the Komodo editor provides a wrapper around the Scintilla API