dandavison / open-in-editor

Open a local file from a URL at a line number in an editor/IDE
54 stars 8 forks source link

How to make the GUI app work with the terminal #12

Closed eugenesvk closed 1 year ago

eugenesvk commented 1 year ago

upd: found the issue Ok, the real issue is I needed to recreated the bundle locally (with the latest Platypus version, not sure if it matters), not sure why the installed bundle refused to work Thanks for this rather tricky hack!

dandavison commented 1 year ago

Hi @eugenesvk, OK excellent! I was writing you a reply which was going to say that (a) I do have it working and use it a lot, but (b) yes it's a bit tricky to debug and I get a bit of a sinking feeling when it isn't working for some reason!

I don't think I've made it work using the cask, but perhaps @danielbayley can chime in. I use duti manually as indicated in the README, but, it always seems to be a murky trip back to the world of 1990s shareware or something! The less we have to remember that PLists and their arcana exist the better I think.

eugenesvk commented 1 year ago

I don't think I've made it work using the cask

Oh, interesting, so you're not using the terminal links to click-to-open files etc? That's the main reason I installed it :)

I think the error might be because by the time I tested the reinstalled bundle again (after trying a local bundle) I might've removed the python symlink

Anyway, I'm using this bundle in this fork with a few modifications besides just the newer Platypus version:

dandavison commented 1 year ago

Oh, interesting, so you're not using the terminal links to click-to-open files etc?

No, that's absolutely how I'm using it. I just don't install using the Homebrew Cask; I place a symlink at /Applications/OpenInEditor.app pointing into the app bundle in this repo, and use duti to register that as the handler for the URL protocol I'm using.

Incidentally, have you tried it with delta's grep support, i.e. with rg --json $search_term | delta or git grep? I find it really useful being able to open search hits at the correct line with a click (as well as nice having syntax-highlighted code in the search results).

Here's rg --json handle | delta in alacritty, using

[delta]
   hyperlinks = true
   hyperlinks-file-link-format = "file-line-column://{path}:{line}"
image
eugenesvk commented 1 year ago

Incidentally, have you tried it with delta's grep support

Haven't gotten to setting up that part yet, but it looks great and will alias rg to always pipe to delta this way (unless there is some rg config that allows using delta as a pager similar to git?)

dandavison commented 1 year ago

Also incidentally, do you use Alacritty? I learned today that this alacritty config allows us to open hyperlinks (with OpenInEditor functionality) without touching the mouse:

hints:
  enabled:
    - hyperlinks: true
      command: open
      binding:
        mods: Command
        key: Period
eugenesvk commented 1 year ago

I mostly use WezTerm, which is much more flexible in configuration (so more like delta :) ), although it hasn't implemented this feature yet, it's still open, so for now you can only open "implicit links" with a keybind by matching text to a regex and then pressing a single alpha key, but it would be great if it also gets implemented for explicit links, would be much more convenient vs a mouse