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

feat: Formatted hyperlinks #997

Open
2crayon opened this issue May 19, 2024 · 2 comments
Open

feat: Formatted hyperlinks #997

2crayon opened this issue May 19, 2024 · 2 comments

Comments

@2crayon
Copy link

2crayon commented May 19, 2024

Currently the hyperlink format in eza is hardcoded to be file:///{path}, ripgrep has the ability to change this format to whatever you want with some nice aliases BurntSushi/ripgrep#2611

I would use this to list files in a project with eza --tree and have links always open in my text editor :)

@gierens
Copy link
Member

gierens commented May 19, 2024

Interesting!

Correct! Eza hardcodes this here:

"{HYPERLINK_START}file://{abs_path}{HYPERLINK_END}"

I looked at the ripgrep sources and they offer predefined aliases (https://github.com/BurntSushi/ripgrep/blob/f1d23c06e30606b2428a4e32da8f0b5069e81280/crates/printer/src/hyperlink_aliases.rs#L4-L22) and a parser for custom formats (https://github.com/BurntSushi/ripgrep/blob/f1d23c06e30606b2428a4e32da8f0b5069e81280/crates/printer/src/hyperlink.rs#L95-L171).

I think switching between predefined formats via a command line flag should be fairly straight forward to implement. Allowing the user to define a custom format is more involved though and also maybe a bit of overkill since we don't have that many interesting information to pack into a link as ripgrep with lines and colums within files. So we might wanna limit the scope when implementing this.

@2crayon
Copy link
Author

2crayon commented May 20, 2024

I think it would also be useful to be able to have different formats for different file types, so e.g. you could say that directories should open in a file explorer and regular files should open in a text editor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants