I'm fairly new to Fish, and I like it so far, but I'm annoyed that abbreviations can't have spaces. For example, when I type git statsu
, which I do more often than the actual command of git status
, I want it to replace the text with the correct command. I have tried adding the following to my config.fish
file:
abbr "git statsu" "git status"
…which gives me:
abbr --add: Abbreviation 'git statsu' cannot have spaces in the word
Second try (alias with spaces not supported):
alias "git statsu"="git status"
- (line 1): function: Unexpected positional argument 'statsu'
function git statsu --wraps 'git status' --description 'alias git statsu=git status'; git status $argv; end
^
from sourcing file -
called on line 61 of file /usr/share/fish/functions/alias.fish
in function 'alias' with arguments 'git\ statsu=git\ status'
called on line 19 of file ~/.config/fish/config.fish
from sourcing file ~/.config/fish/config.fish
called on line 1 of file -
in function 'config'
Similarly, I try:
alias "git\ statsu"="git\ status"
Which fails silently:
> git statsu
git: 'statsu' is not a git command. See 'git --help'.
The most similar command is
status
And finally (abbreviations after first argument not expanded):
abbr statsu status
> git statsu
git: 'statsu' is not a git command. See 'git --help'.
The most similar command is
status
Please offer alternative solutions; I am tired of constantly typing the wrong command and having to correct it manually.
Why don't you use git aliases instead. Here are a couple of mine:
$ cat ~/.gitconfig
...
[alias]
co = checkout
stat = status
Here's a fish thing you can do that's easy to expand with other common typos:
function git
switch $argv[1]
case statsu
set argv[1] status
end
command git $argv
end