fish: add command option for abbreviations (#6666)

The fish shell has added a flag to the abbr command which allows one to expand it only if it is typed after a real command e.g.:
git s -> git status
s -> s

Also see the last example here: https://fishshell.com/docs/current/cmds/abbr.html#examples
This commit is contained in:
Karun Sandhu 2025-03-20 04:43:42 +01:00 committed by GitHub
parent cfaa4426a3
commit 8675edf7d3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 17 additions and 1 deletions

View file

@ -34,6 +34,10 @@
end
'';
};
co = {
command = "git";
expansion = "checkout";
};
dotdot = {
regex = "^\\.\\.+$";
function = "multicd";
@ -64,6 +68,8 @@
cd ..
end
'"
assertFileContains home-files/.config/fish/config.fish \
"abbr --add --command git -- co checkout"
assertFileContains home-files/.config/fish/config.fish \
"abbr --add --function multicd --regex '^\.\.+$' -- dotdot"
'';