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

Tech Debt Best Practices: Minimizing Opportunity Cost & Security Risk

Tech debt is an unavoidable consequence of modern application development, leading to security and performance concerns as older open-source codebases become more vulnerable and outdated. Unfortunately, the opportunity cost of an upgrade often means organizations are left to manage growing risk the best they can. But it doesn’t have to be this way.

Read More
Scroll to Top