Zsh: There's More To Shell Aliases Than You Might Think

Поделиться
HTML-код
  • Опубликовано: 28 авг 2024

Комментарии • 43

  • @bobkoss280
    @bobkoss280 4 года назад +2

    I've only used simple aliases - until now. Learned a lot. Thanks.

  • @thingsiplay
    @thingsiplay 3 года назад +1

    I switched to Fish and one thing I really enjoy is abbreviation. The expansion of abbreviations when typing them in the terminal is really useful. Not only because I do see what it does, I can also change the arguments right there before execution. To me this is a killer feature.

    • @BrodieRobertson
      @BrodieRobertson  3 года назад +2

      I really should try fish

    • @johnjoyce
      @johnjoyce 3 года назад +2

      Fish is great until you run a tool that wants posix sh compliance or a tool that thinks bash is the only thing

  • @iLiokardo
    @iLiokardo 4 года назад +1

    alias -g. i think abbrev is better.
    meaning, type something you've defined; then do a space or punctuation and the abbreviation will expand.
    benefit of immediate feedback.

  • @senninscorpion
    @senninscorpion 4 года назад +1

    I only use alias something='command', and with Luke Smith, I learned that I don't need to type "alias xyz=" again, just
    alias v="nvim" \
    vim="nvim"

    • @BrodieRobertson
      @BrodieRobertson  4 года назад +1

      For the same reasons that I don't like defining variables in a programming language like this, I'm not a fan of defining aliases like this.

  • @linuxcaffe
    @linuxcaffe 4 года назад +1

    WOW! Good one Brodie! I learned a bunch! Thanks!

  • @p00pyfarter
    @p00pyfarter 4 года назад +9

    Dude sorry but that “ping” noise for the subscribe animation is kind of like nails on the chalkboard and a little loud in comparison to your levels

    • @BrodieRobertson
      @BrodieRobertson  4 года назад +2

      I can lower it, I've been using it for at least 3 months and you're the first person to mention it

  • @awabqureshi814
    @awabqureshi814 4 года назад +4

    I use the OS specific alias to run chrome on mac os when I type "chromium", so that I can keep the same scripts from linux and mac os.
    On mac for some reason launching chrome by typing chrome doesn't work, so I just make the alias execute the launch script thing inside the chrome folder in mac os' applications folder.

    • @BrodieRobertson
      @BrodieRobertson  4 года назад

      That's odd, I don't really use MacOS enough to notice that

    • @AkamiChannel
      @AkamiChannel 4 года назад +1

      I think to launch chome in macos is: $ open -a "Google Chrome"

  • @scorch855
    @scorch855 3 года назад +2

    A lot of my aliases became too complex over time so I had to convert them to functions. I don't have any OS specific aliases which are completely unique but I do use the same idea to have different versions of an alias depending of the system because windows can require some work arounds. I also have some tmux specific aliases which I detect in a similar way.

  • @willson3239
    @willson3239 4 года назад +1

    global aliases are a neat idea, but can get weird as you mentioned. the grml zshrc has a neat 'abbreviation' implementation that acts like global aliases but can be a bit safer to use as they are expanded to their meaning explicitly/implicitly as you want.

  • @iLiokardo
    @iLiokardo 4 года назад +1

    'source .zsh'
    you could also use 'exec yourshell'

  • @umka7536
    @umka7536 4 года назад

    I use normal and suffix aliases in zsh.

  • @bobkoss280
    @bobkoss280 4 года назад +2

    Do you have any interest in cleaning up ~/ like Luke has his? I see what he has, and I see what I have (similar to what you have) but I can't see a way to get from A->B without breaking my world. If this interests you, a video would be great.

    • @BrodieRobertson
      @BrodieRobertson  4 года назад +1

      I've never really thought about fixing it but it could make an interesting video

  • @iLiokardo
    @iLiokardo 4 года назад +1

    ah, you got electric quote pairing. do you have it for all the types of brackets as well?

    • @BrodieRobertson
      @BrodieRobertson  4 года назад

      Electric quote pairing? Do you mean auto pairing. I have it for all except for because it conflicts with my html tagging plugin.

    • @raxa45
      @raxa45 4 года назад

      I use the zsh-autopair plugin. Is electric another one?

    • @iLiokardo
      @iLiokardo 4 года назад

      @@raxa45 "electric" is the term Emacs uses, for bracket auto pairing and auto indenting.
      I guess i won't use the term "electric" now, "auto" seems better to use.

  • @PestisNonSapien_GMO_exHuman
    @PestisNonSapien_GMO_exHuman 4 года назад

    I only use bash so I use normal aliases and functions. I don't consider functions to be an alias I haven't thought about using global aliases. Reminds me of sub on MUDs. I rarely used them there.

  • @tapank415
    @tapank415 4 года назад +2

    Also Take a look at gotbletu's dotfiles.

    • @BrodieRobertson
      @BrodieRobertson  4 года назад

      He's done his own videos on them I don't know what I could say that he didn't already say.

  • @Babbler49
    @Babbler49 4 года назад +3

    how portable is `$OSTYPE`, especially compared to `uname`?

    • @humm535
      @humm535 4 года назад +6

      uname(1) is in POSIX, $OSTYPE is not.

    • @iLiokardo
      @iLiokardo 4 года назад

      tried echoing it now in Debian, nothing there.

    • @Babbler49
      @Babbler49 4 года назад

      @@humm535 Ah good to know.
      Tried $OSTYPE on my machine's shells, bash and zsh had them, while bash as sh and dash didn't have.

  • @fuseteam
    @fuseteam 4 года назад

    uh alias work after after the pipe because it's technically new command, it should also work after && and ;

    • @BrodieRobertson
      @BrodieRobertson  4 года назад

      I don't typically come into situations where I have 2 commands aliased that I want to chain

    • @fuseteam
      @fuseteam 4 года назад

      @@BrodieRobertson i suppose but it's not really string subsitution it's really still command substitution
      if you run cat .zshrc | color it will say "unknown command"
      string substitution can be achieve with !!:0-2 and it's variants and ^zsh^bash and its variants

  • @xtnctr
    @xtnctr 4 года назад

    Awesome.

    • @BrodieRobertson
      @BrodieRobertson  3 года назад

      Thanks, RUclips apparently doesn't tell you when you get a new member, I only just checked the list.

  • @qawsfgtwgshsghsfdvf
    @qawsfgtwgshsghsfdvf 4 года назад

    How about a keybinding follow up in zsh using tmux. I dont like typing my alias.

  • @arvindhn036
    @arvindhn036 4 года назад

    You don't have to type source everytime. Alternatively, you may use . ~/.zshrc

  • @SenthilBabuji
    @SenthilBabuji 4 года назад

    I was searching in the comments that bash nerd to tell how to do all these things in bash and tell zsh is not necessary. 😜
    And of course it can be done in bash through other means.

  • @HeCodes2Much
    @HeCodes2Much 4 года назад

    They can also be a function tooo they don't need to be a single line... Example here mate lol github.com/TheCynicalTeam/DotFiles/blob/master/.bash_aliases

  • @schlaus_kwab
    @schlaus_kwab 2 года назад

    the baby beard is very distracting