[Feature Request]: OSC8 Hyperlinks
Summary: It would be great if tig had external llinks in-terminal for linking to a remote repo's respective web front-end. eg. clicking on a commit hash could send you to the commit on gitlab or on a blame datestamp could send you to the remote blame line.
OSC8 Hyperlinks are essentially links in the terminal. If your specially decorated terminal output conforms to the spec and the terminal emulator is OSC8 aware, you get a link.
Some info: https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda
If it already exists in tig somewhere, I apologize for the issue, but I couldn't find anything. I think it would be really neat and a boon to many common workflows.
Why
It's very common in a modern git workflow to interface with some git web front-end before, during, or after development so I think tig could really benefit from providing links for better navigation. After running a tig blame somefile, it'd be nice to be able to just "click" on the commit id to get sent to maybe... a remote git blame at the remote's web front end or some other pertinent destination. Theoretically, you could even use a custom protocol and run a command or do something fancy like open a pr strictly from the link. Tig's job would just be populating an invisible set of href-like characters around the text that's already being displayed.
How
Since tig already labels many relevant UI elements for colors, I think using the same names for their potential links makes sense. I don't think tig should apply links by default (because who knows where you want to go and git is a distributed thing), but it'd be nice to add a few lines in your config and now you have consistent hyperlinks throughout for the hosts you care about.
Tig can get the remote url's from git with
git remote get-url
which might get you [email protected]:user/jonas/tig/.git
Then you add something like this for github.com in your tig config
# ~/.config/tig/config
link github.com id https://${remote_host}/${remote_repo}/commit/${id}
link github.com date https://${remote_host}/${remote_repo}/commit/${id}/blame/${branch_name}/${file_name}#${line}
link github.com user https://${remote_host}/${user}This (or something vaguely like this) would allow you to have different link configs for different hosts (Gitlab, sourcehut, codeberg etc.) which all have their own url format.
so instead of user being printed in tig, you'd get \e]8;;https://github.com/user\e\\\\user\e]8;;\e\\\n which would then be clickable
Many other terminals applications produce OSC8 links. I see quite a few git related applications too. https://github.com/Alhadis/OSC8-Adoption
The foot terminal (and many terminals now) have good support for these links too https://man.archlinux.org/man/extra/foot/foot.ini.5.en#SECTION:_url
Source: jonas/tig