Settings

Theme

Show HN: Ssort – I got sick and vibe coded a stream priority sorter

github.com

1 points by xlii a month ago · 2 comments · 1 min read

Reader

Hi HN,

I've been coding for over 20 years, and I've always had this specific annoyance: when I grep or rg through a codebase, the definitions or declarations I actually want to see are often buried in the middle of the stream.

I got tired of crafting magic regex sequences to find them, so when I came down with the (actual) flu this week and needed to occupy my brain, I built ssort.

It's a CLI tool that buffers input and bubbles specific matches (like "struct", "class", "func") to the top while flushing the rest later. It was partially "vibe coded" with Gemini during (ongoing) recovery.

It's simple, written in Go, and finally solves my search ordering problem. Hope you find it useful.

treetalker a month ago

Layperson question: how does this differ from, say, piping something to fzf; and what advantages does it have over that?

  • xliiOP a month ago

    Good question - main thing is that it's saving time on repeatable searches and optimize search.

    I was working with Elixir without ability to use LSP and so, my flow often looked like this:

        > rg "defp|def\b|def_rule|def_helper" . | rg "something"
    
    Only to find that someone made a "def_instruction" and it's there. I didn't want to filter our, I just wanted to... sort.

    With config file I can do a simple

        > rg "something" | ssort ~/ssort/elixir_methods
        > # or if I use it often
        > alias ssort-elixirm "ssort ~/ssort/elixir_methods"
        > rg "something | ssort-elixirm
    
    This can be solved by working LSP though, what working LSP can't solve though is:

        > rg "impl" | ssort-elixirm | ssort -f MyCompany
    
    But (given as it looks like it was buried) it's a microoptimization for CLI search freaks ;)

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection