2

Probably easier to just use an example here. I have a function ss that just calls:

sudo systemctl $argv

Tab completion works fine with the full command, but not for the ss function. I.e.,

ss start mys<tab>

tries to complete from the filesystem rather than using the completion function for systemctl command.

1 Answer 1

3

After some reseach, it seems that there are two upcoming features in fish, neither of which is in the current stable release (2.1.1).

The first is a --wraps argument to function and complete, which enables completion inheritance. function foo --wraps=bar gives foo all completions registered for bar.

The second is abbreviations through the abbr command, which work much like vim abbreviations. abbr -a gco='git checkout' registers an abbreviation gco to expand to git checkout. Typing gco followed by a space or enter expands the abbreviation, which naturally allows for any registered completion to work.

Without either of these features, the only remaining thing to do is to write a custom completion script for your function/alias, which is silly.

1
  • Both of these features are now a part of fish. Cheers!
    – user229351
    Sep 11, 2018 at 9:46

You must log in to answer this question.

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