Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for rendering filenames as hyperlinks #396

Closed
liff opened this issue Jun 13, 2018 · 24 comments
Closed

Add support for rendering filenames as hyperlinks #396

liff opened this issue Jun 13, 2018 · 24 comments
Assignees
Labels
features › terminals Terminal features and ANSI codes

Comments

@liff
Copy link

liff commented Jun 13, 2018

Some terminal emulators support escape sequences that can be used to mark text as a hyperlink.

Could a similar option perhaps be added to exa? Coreutils ls supports this since 8.28.

@Don42
Copy link
Contributor

Don42 commented Jul 13, 2018

Sounds interesting, I expect this depends on #211 being implemented.

Edit:
No longer sure if there really is a dependency. I forgot how complex character
escapes can be.

@ogham ogham added the features › terminals Terminal features and ANSI codes label Sep 24, 2018
@ogham ogham self-assigned this Sep 24, 2018
@ogham
Copy link
Owner

ogham commented Sep 24, 2018

I had no idea about this feature, but it looks really useful!

@jcklpe
Copy link

jcklpe commented Mar 18, 2019

+1 to this feature.

@ahsanp
Copy link

ahsanp commented Apr 25, 2021

Hi! Given that ansi_term doesn't yet support hyperlink painting, would it be okay to make a pull request that supports this painting without using ansi_term?
More specifically, one would add in the hyperlink escape codes in the render functions. That way we can avoid messing up text cell width in the output.

@ariasuni
Copy link
Collaborator

Well, I guess you could just make a PR for ansi_term (which is also maintained by ogham) directly, though it sounds a little bit more complicated.

@ahsanp
Copy link

ahsanp commented Apr 27, 2021

That sounds great! Thank you!

@mpldr
Copy link

mpldr commented Aug 11, 2021

No longer sure if there really is a dependency. I forgot how complex character
escapes can be.

Pretty easy actually… since it's just a URI, you can use normal URI-encoding (space -> %20 and so on). Maybe this helps (it's in Go though) https://git.sr.ht/~poldi1405/go-ansi/tree/master/item/hyperlinks.go#L20

@XhstormR
Copy link

Maybe can add file:/// prefix, eg: file:///Users/user/Downloads/123.txt

@XhstormR
Copy link

This feature is really helpful.

@valpackett
Copy link

valpackett commented Sep 13, 2021

Looks like there is an ansi_term PR: ogham/rust-ansi-term#61

But ansi_term doesn't seem very actively maintained… maybe it would be a good idea to migrate to termwiz ;)

@ariasuni
Copy link
Collaborator

Well, I didn’t look at termwiz, but it could be interesting to try to use it instead of rust-ansi-term and see if it’s still as performant/doesn’t grow the binary too much/etc.

@aaccioly
Copy link

aaccioly commented Feb 5, 2022

Kitty has a great implementation of Hyperlink actions. To the point that I now naturally expect to be able to click on files, URLs, etc and expect my terminal emulator to launch something useful.
It would be lovely if exa would implement this feature.

@mpldr
Copy link

mpldr commented Feb 8, 2022 via email

@jasonjckn
Copy link

jasonjckn commented Jul 31, 2022

+1 feature request

@akharrou
Copy link

+1

1 similar comment
@Dapacruz
Copy link

+1

@ttys3
Copy link

ttys3 commented Oct 14, 2022

lsd already has it.

lsd-rs/lsd#642

@Dapacruz
Copy link

lsd already has it.

Peltoche/lsd#642

For this reason I use lsd, but I like how exa ignores files listed in .gitignore.

@daviessm
Copy link
Contributor

This would be a good first issue for someone new to the project, based on the implementation in lsd.

@Jackenmen
Copy link

Note that lsd's implementation does not put the hostname in the URL which the spec referred to in the issue description considers mandatory:
https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda#file-uris-and-the-hostname

In practice, this allows capable terminal emulators to handle non-local file URLs properly, e.g. download the file to a temporary local file through SSH before trying to open it which is what, for example, kitty or iTerm 2 can do:

@mpldr
Copy link

mpldr commented Oct 14, 2022 via email

@Jackenmen
Copy link

Jackenmen commented Oct 14, 2022

The specification I linked (which is the specification for hyperlinks in terminal emulators) mentions RFC 8089 and explicitly chooses to be stricter here and requires always specifying the hostname.

Besides, the tool can't reliably know whether it's running in a "local" context or whether it's running in the ssh context. For the tool running on some computer, all files are considered local but that doesn't mean that the terminal emulator itself runs on that same computer (as is the case for SSH).

@mpldr
Copy link

mpldr commented Oct 14, 2022 via email

@ariasuni
Copy link
Collaborator

exa is unmaintained (see #1243), and this has been done in the active fork eza, so I’m closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
features › terminals Terminal features and ANSI codes
Projects
None yet
Development

No branches or pull requests