2

In bash you can expand an alias you type. For example if I have an alias cmd="cd ~/user", typing in cmd and then hitting Ctrl+Alt+e would change it to cd ~/user. Is there a way to do this with fish?

  • Have you looked at this bug and subsequent fix: github.com/fish-shell/fish-shell/issues/393 ? It sounds like what you are looking for, but I'm not familiar enough with fish to be sure; it sounds as though cmd + enter will substitute the alias with the definition. – Argonauts Jun 22 '16 at 4:05
4

In fish the alias command just creates a trivial function. For example,

alias cmd 'cd ~/user'

Is simply shorthand for

function cmd
  cd ~/user
end

Because it's a function in fish you can't expand the body in the command line as you type the alias. For your situation I recommend an abbreviation; e.g., abbr cmd 'cd ~/user'.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.