Skip to content

Conversation

@josephschmitt
Copy link

@josephschmitt josephschmitt commented Jul 13, 2025

Adds a new option for @fzf-url-sort-by, defaulting to alphabetical as before, and adding recency to sort urls by recency in the scrollback history.

Most of the time when I use this plugin, I want to open the url that just got printed (usually a github PR). Sorting be recency makes it so 9/10 times, I invoke the plugin and hit enter to open it right away. Setting recency to have links sorted by the order they appear in scrollback puts the most recent links closest to the fzf search bar. If you use --reverse with fzf, it’ll detect this and reverse the sort order to maintain the most recent url’s to be closest to the search bar and row selection.

@josephschmitt josephschmitt force-pushed the master branch 2 times, most recently from 41074ed to 41ec345 Compare July 13, 2025 16:05
Adds a new option for `@fzf-url-sort-by`, defaulting to `alphabetical` as before, and adding `recency` to sort urls by recency in the scrollback history.

Most of the time when I use this plugin, I want to open the url that just got printed (usually a github PR). Sorting be recency makes it so 9/10 times, I invoke the plugin and hit enter to oepn it right away.
@josephschmitt josephschmitt marked this pull request as ready for review July 13, 2025 16:08
Comment on lines +70 to +73
if (!seen[url]) {
seen[url] = 1
print $1 ":" url
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the same URL appears multiple times, shouldn’t we keep the line number of its last occurrence instead of the first?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wfxr Ohhh, that's an interesting idea. wdyt? I could go either way

Copy link
Owner

@wfxr wfxr Jul 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@josephschmitt IMO it's more intuitive to sort by the last occurrence. However, if this is much more complicated to implement, the current solution is acceptable.

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

Successfully merging this pull request may close these issues.

2 participants