Open the same file in different directories

Open the Same File in Different Directories

Macro Monday – a new macro to dig into every Monday!

The Macro

This is a startup macro (set to trigger when Komodo starts up) that creates a new editor tab context menu, to allow opening the current file in an alternative location. The alternative locations are read from the *locations.ini* file in the Komodo profile directory.

Screenshot

Here’s a screenshot showing the tab context menu for my configuration:

Locations Configuration File

Here is my “locations.ini” config file on Linux:


# Anything starting with # is a comment.
komodo ide = /as/komodo-devel
clean branch = /as/komodo-devel_clean
8.5.x branch = ~/as/komodo-devel_8.5.x
komodo edit = /as/komodo-edit

Given the above configuration, if I had this file open in Komodo:


/as/komodo-devel/src/libs/controller.js

I could right click on the tab, choose “Open at location > 8.5.x branch”, and Komodo would open this file:


~/as/komodo-devel_8.5.x/src/libs/controller.js

Note that the current file needs to be matched to one of the configuration
directories, otherwise there would be no way to determine the relative path. The macro gives a warning in such a case.

Installation

To install the macro simply hit the “View Resource” and “Install Instructions” links below.
Once installed – open the Macro properties and set the macro to trigger on the Komodo startup event.

 


Install Instructions

Related Materials

  • Komodo Developer Extension – play around with JavaScript or Python code in the context of the Komodo window
  • Komodo Macro API – to programatically interact with the Komodo editor – available to both Python and JavaScript

Title image courtesy of Ag Ku on Pixabay.

Recent Posts

Scroll to Top