Search code examples
autocompletefish

filename autocomplete in reverse order


I would like to know if there is a way to tell fish to reverse the output of autocomplete for certain commands and even better for certain repositories (I doubt even more about this one). I looked into the complete command but I believe it's different to what I want.

So if I have a folder A like this (hopefully that's clear enough)

A

A1

A1A
A1B
A1C
etc...

A2

A2A
A2B
etc...

And I run let's say the "cd" command in the A folder like so cd A<TAB> I get this autocomplete prompt

> cd A
A1/ A2/

So is there a way to actually get

> cd A
A2/ A1/

Thanks for your time !


Solution

  • I would like to know if there is a way to tell fish to reverse the output of autocomplete for certain commands and even better for certain repositories (I doubt even more about this one)

    In short: Basically no.

    In longer: You can provide completions that keep their order with complete --keep-order, but that would require modifying basically the entire completion script for a command, and fish provides no facilities to apply that to its built-in file completions, so you'd have to provide the files through script.