gpakosz/.tmux

Find a replacement for urlview (unmaintained)?

maxbrunet opened this issue ยท 15 comments

It seems urlview is no longer maintained1. Packaging systems will start dropping it (e.g. NixOS/nixpkgs#274280) as issues will accumulate with no hope for them of being fixed upstream.

Some alternatives:

I have only tried urlscan so far, and it looks like a good drop-in replacement.

Footnotes

  1. https://salsa.debian.org/debian/urlview/-/commit/4ad7d236c745b665db1d2fd07ce5ffc1748e4240 โ†ฉ

Hello @maxbrunet ๐Ÿ‘‹

Maybe the binding should be dropped entirely

Hello @gpakosz ๐Ÿ‘‹

It is true that I don't use it so much, so I likely would not miss it. I only use it every once in while to find a new PR link for a branch pushed recently

I suppose one could configure a binding in the local config or use a plugin if they would like the feature back

Maybe if there's an Homebrew formula for urlscan I might keep it

Or I could support both, giving preference to urlscan

A few Linux distros have a package for it: https://repology.org/project/urlscan/versions

But I cannot find it in Homebrew. On macOS, it would be Nix, MacPort, or pipx at the moment

Can you please try the gh-695 branch?

Thank you, I tested it and this technically looks good to me, however now that I see urlscan in action with the config, I am not convinced by the default experience, the output is very verbose and feels barely more useful than scrolling up the shell output in my opinion (pressing c helps to get a compact view, but the / binding closes it instead of searching) (it also matches my username@machine prompt as an email address)

One might want to use the --compact, --dedupe, and --regex 'https?://.+' flags, but not sure if everyone would agree if the config hardcodes them. I wonder if adding an option to choose the command would be possible with the default still being urlview (that would make experimentation easy at least)

And if that's adding too much complexity, dropping the feature is still on the table imo (personally I do not depend on it heavily in my day to day)

Updated the gh-695 branch with the options you suggest

Thank you for the update, it works and looks very close to what we have with urlview.

--dedupe is inefficient for me, because my right prompt contains a timestamp and that makes each URL "unique", that would probably be an issue to discuss upstream

If you decide to ship this change, I would update the README to mention urlscan as well:

.tmux/README.md

Line 134 in 5354501

- [Urlview][] integration if available

Thanks a lot for your time and responsiveness! โค๏ธ

Edit: I actually took the example regex from the man page, but there's a formatting problem when it is rendered, it is --regex 'https?://.+\.\w' , that way the regex stops matching when it encounters white-spaces

But that regex is not perfect either, we can do without --regex for simplicity's sake, I think I would be ok if my prompt appears once in the result ๐Ÿ˜…

I think I would be ok if a my prompt appears once in the result ๐Ÿ˜…

What prompt are we talking about?

$PROMPT, urlscan tries to be smart and guesses user@host in the prompt as an email address even though it is not a mailto: URL

But --regex 'https?://.+\.\w' solves this right?

No, unfortunately this regex is too simplistic and does not match all possible URLs (e.g. http://localhost:3000, and I tried to remove \. or change \.\w, but it gets truly complex to have an accurate regex)

This is the default in urlview:

(((http|https|ftp|gopher)|mailto):(//)?[ห† <>"\t]*|(www|ftp)[0-9]?\.[-a-z0-9.]+)[ห† .,;\t\n\r<">\):]?[ห†, <>"\t]*[ห† .,;\t\n\r<">\):]

And this is urlscan: firecat53/urlscan@1.0.1/urlscan/urlscan.py#L248-L273

I think it is simpler to do without --regex and use urlscan --compact --dedupe only

Or I removed the use of --regex

Or I removed the use of --regex

Yes, that's what I suggest :)

I meant "ok I removed ..." ๐Ÿ˜… Damn autocarrot! ๐Ÿฅ•