This is a personal project under development, implemented only for MacOS (e.g. it uses hammerspoon in places, and the open
command). VSCode is the only editor tested, but it could be made to work with others (e.g. JetBrains IDEs) with minor modifications. The terminal emulator must either be Wezterm, or Alacritty+Tmux. It could be made to work with non-Alacritty+Tmux with minor modifications.
Wormhole is for people who:
- work on multiple projects/repositories concurrently
- use an editor/IDE that does not run in the terminal
- use a terminal that is not the integrated terminal of their IDE
When you switch to work on a different project, two things should happen:
- Your editor/IDE should switch to the new project workspace.
- Your terminal emulator should switch to a window/tab/workspace with shell processes using the new project directory.
Wormhole makes that be true. It is an HTTP service providing the following commands:
- Switch to a project by name
- Switch to a project given a file path, and open that path in your editor/IDE (at the specified line number)
- Switch to a project given a github URL, and open the corresponding file path in your editor/IDE (at the specified line number)
Wormhole binds to port 7117 by default.
- Clone this repo
- Check that the editor and other settings in
src/config.rs
are appropriate for your environment - Install hammerspoon and ensure that the
hs
executable is on your$PATH
E.g.brew install hammerspoon ln -s /Applications/Hammerspoon.app/Contents/Frameworks/hs/hs ~/bin
- Start the server with
sudo make serve
Wormhole is an HTTP server. It can be used in various ways, with various HTTP clients. Here are some ideas.
-
Use the MacOS project-switcher UI to switch projects.
-
Wormhole understands GitHub URLs:
Use the requestly chrome extension to send GitHub links to wormhole via rules like:
- URL RegEx
/^https://github.com/([^#]+/blob/[^#?]+)(?:#L(\d+))?(?:-L\d+)?$/
Redirect to URLhttp://localhost:7117/$1?line=$2
- URL RegEx
/^https://github.com/([^#]+/blob/[^#]+\?line=\d+)$/
Redirect to URLhttp://wormhole:7117/$1
Now GitHub URLs in Google Docs, Notion, Swimlanes.io, etc will open via Wormhole.
- URL RegEx
-
Open code from terminal applications that create terminal hyperlinks, such as delta and ripgrep.
-
Hammerspoon can send HTTP requests via a keybinding, e.g.
hs.hotkey.bind({ "cmd", "control" }, "left", function() hs.http.get("http://localhost:7117/previous-project/", nil) end)
The fundamental point is that Wormhole opens code in your editor/IDE at the correct line, while ensuring that your editor/IDE selects the correct project workspace for the file, and also switches your terminal emulator to that project.