1

With my fish shell, I have defined the alias

alias black='command black -l 110'

When I type black in my shell and start to tab-complete, I get the error

complete: maximum recursion depth reached

The same thing happens with similar aliases such as

alias readelf='command readelf -W'

1 Answer 1

4

If I enter

alias readelf='command readelf -W'

into a fish shell, this is what fish does with it:

$ type -a readelf
readelf is a function with definition
# Defined via `source`
function readelf --wraps='command readelf -W' --description 'alias readelf=command readelf -W'
  command readelf -W $argv;
end

The --wraps argument, which controls completions, looks wrong.

Since fish creates functions for aliases, just create the function yourself:

function readelf --wraps=readelf
  command readelf -W $argv
end

Ref: https://fishshell.com/docs/current/cmds/function.html

2
  • Still getting the error. After typing in exactly what you recommended, type -a readelf produces function readelf --wraps='command readelf -W' ... Commented Oct 27, 2021 at 16:56
  • 1
    You're running this in a fish that already has the alias loaded, so the wrapping remains in place. Replace your alias with the definition at the bottom and restart fish. Ideally call your function something else, it's always better when names refer to the normal things.
    – faho
    Commented Oct 29, 2021 at 11:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .