4 ms·
My favorite feature of fish is `abbr`, e.g. `fish abbr --add g git`. Then you type `g` followed by space and it just expands it to `g` and you then get all the
by ElijahLynn 8y ago
My favorite feature of fish is `abbr`, e.g. `fish abbr --add g git`. Then you type `g` followed by space and it just expands it to `g` and you then get all the autocomplete goodness and don't have to futz with adding autocomplete support to an alias, because it is the real command. It also helps for presentations because instead of some obscurely named alias, you can type an abbreviation and it just expands it out for the viewer to see and learn from. On top of that, I make abbreviations with long options, that way I can see exactly what is going on and effectively edit the commands.
- ludwigvan 8y agoNice, thank you. I have been using fish for a long time, but wasn't aware of these. Have defined the following: abbr -a gp 'git push' abbr -a k kubectl abbr -a n 'npm run' abbr -a y yarn abbr -a m make Now, when I type n, then SPACE, then TAB, I can get the list of npm tasks for example.
- floatboth 8y agozsh also does correct autocompletion for aliases, if you enable the counterintuitively-named 'no_complete_aliases' option
- modernerd 8y agoYou can also type fish_config to launch the fish config web app in your browser. From there you can add, edit and remove abbreviations from the “abbreviations” tab directly. I find this a really user-friendly way of managing abbreviations I've created.