Terminal hyperlinks
# For Sublime Text
This magic script adds links to the gcc or clang output:
It will break if the ANSI escape codes formatting will be changed some day, but anyway. It also breaks formatting, too lazy to fix.

src/main.c:90:11 should be bold, but it’s not.
Then you have to pipe stderr from the compiler to it, e.g. in fish:
| |
To keep colors from the compiler output, use -fdiagnostics-color=always flag with gcc or clang.
To open the links, you have to set up a custom subl protocol. No, I didn’t come up with a better solution. How to do this:
xdg - Create a custom URL Protocol Handler.
Create a .desktop file in ~/.local/share/applications:
| |
Then run:
| |
This adds an entry to ~/.config/mimeapps.list. And does something else maybe, because simply removing subl from that file and rebooting didn’t remove the protocol handler from the system. Meh.
The script (subl-opener.sh):
| |
Only one issue left - xdg-open is slow on my laptop. The subl command by itself is very fast. Sigh.
| |
# kitty
If you use kitty, you don’t have to deal with xdg-open, just add this to
open-actions.conf:
| |
Kitty checks it first, so it doesn’t use xdg-open. The downside is that it’s also a bit slow. But faster than xdg-open!