zyedidia / micro

A modern and intuitive terminal-based text editor
https://micro-editor.github.io
MIT License
25.04k stars 1.17k forks source link

Open URL (feature request) #1794

Closed reagle closed 10 months ago

reagle commented 4 years ago

It'd be handy to be able to open a URL if the cursor is located within it, or at least to highlight the URL and perhaps I could then get iTerm to launch it.

zyedidia commented 4 years ago

I think this can be left to the terminal emulator. For example in iTerm2, you can hold Command and hover over a link to open it.

reagle commented 4 years ago

@zyedidia thanks for the suggestion; two things:

  1. I often like to use the keyboard only.
  2. Your iTerm2 suggestion does not work for me when URLs are wrapped. As you can in the image below, only the first part of the URL is underlined (and will be opened when clicked, yielding a 404.)
Screen Shot 2020-07-22 at 3 36 01 PM
reagle commented 4 years ago

This iTerm2 issue sounds like my own, but not sure what to do about it.

reagle commented 4 years ago

Changing the iTerm2 option to yes doesn't do anything for me.

Screen Shot 2020-07-23 at 12 28 48 PM
dmaluka commented 4 years ago

It seems the terminal emulator would rather not be able to handle it: for example, how does it know that the whitespace at the beginning of 2nd line in the screenshot (the ruler) is not a part of the wrapped text?

So it seems it should be implemented on the editor level, but rather not in Micro itself but as an external plugin. I think this is exactly a kind of feature to implement in a plugin.

zyedidia commented 4 years ago

Yeah, this is a good point and should be implemented in the editor at some level. For the time being, you can toggle line numbers (Ctrl-r) and then use iTerm2 to click the link, and then re-enable line numbers.

reagle commented 4 years ago

@zyedidia, ah did not know about the toggle. I imagine I'd have similar problems when using spell checkers which alter the left margin.

pyfisch commented 3 years ago

Hyperlinks (a.k.a. HTML-like anchors) in terminal emulators proposed a new escape code to open URLs and it is already widely implemented.

RichardFevrier commented 1 year ago

Using Wezterm I am able to open links if they are directly in the shell prompt or in Vi (just with a single click without any Ctrl or else) but not in Micro.

dustdfg commented 11 months ago

I can propose something like foot's terminal approach

pjg11 commented 10 months ago

I made a plugin for this feature

reagle commented 10 months ago

Thank you @pjg11 !