top | item 43266368

(no title)

tester457 | 1 year ago

For more power try fish's abbreviations.

With `--position anywhere` you can expand an abbreviation even if it's not at the beginning of a line.

discuss

order

dmd|1 year ago

Another great advantage of fish abbreviations is your history shows the actual command that was run (and in fact as soon as you've typed it, it expands, so you SEE what you're running).

jacobsenscott|1 year ago

Yes, essentially on the fly editable aliases. Fish is so good. I assume there's a zsh plugin that mimics that functionality - zsh people should try it.

mattgreenrocks|1 year ago

I like putting my "aliases" into the functions directory of my config.

I have one that uses podman if it's available when I type `docker`. If I ever specifically need Docker I can use the fully-qualified path. I have a similar trick for `nvim`/`vim`.

watusername|1 year ago

This is the right way. I mentioned in another comment, but abbreviations also shine when screen sharing: Everyone can follow along quickly without having to ask the "what does this gcob command do" questions.

sisk|1 year ago

zsh also supports the "alias anywhere" concept (their term is "global alias") by using the `-g` flag.

   alias -g ag='2>&1 | grep'
   some-command ag 'words' # equivalent to: some-command 2>&1 | grep 'words'

alkh|1 year ago

Yeah, it's very convenient. Here are a few of mine(tested on OS X):

  alias -g L="| less"
  alias -g T="| tee"
  alias -g C="| pbcopy"
  alias -g @all="> /dev/null 2>&1"
  if command -v rg > /dev/null; then
   alias -g G="| rg"
  else
   alias -g G="| grep"
  fi