gpakosz / .tmux

🇫🇷 Oh my tmux! My self-contained, pretty & versatile tmux configuration made with ❤️
MIT License
21.73k stars 3.34k forks source link

Find a replacement for urlview (unmaintained)? #695

Closed maxbrunet closed 8 months ago

maxbrunet commented 8 months ago

It seems urlview is no longer maintained^orphan. 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.

gpakosz commented 8 months ago

Hello @maxbrunet 👋

Maybe the binding should be dropped entirely

maxbrunet commented 8 months ago

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

gpakosz commented 8 months ago

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

Or I could support both, giving preference to urlscan

maxbrunet commented 8 months ago

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

gpakosz commented 8 months ago

Can you please try the gh-695 branch?

maxbrunet commented 8 months ago

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)

gpakosz commented 8 months ago

Updated the gh-695 branch with the options you suggest

maxbrunet commented 8 months ago

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:

https://github.com/gpakosz/.tmux/blob/5354501a5bff69457b37132c1959e9063b1c1714/README.md#L134

Thanks a lot for your time and responsiveness! :heart:

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 :sweat_smile:

gpakosz commented 8 months ago

I think I would be ok if a my prompt appears once in the result 😅

What prompt are we talking about?

maxbrunet commented 8 months ago

$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

gpakosz commented 8 months ago

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

maxbrunet commented 8 months ago

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

gpakosz commented 8 months ago

Or I removed the use of --regex

maxbrunet commented 8 months ago

Or I removed the use of --regex

Yes, that's what I suggest :)

gpakosz commented 8 months ago

I meant "ok I removed ..." 😅 Damn autocarrot! 🥕