Тёмный

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

Brodie Robertson
Подписаться 85 тыс.
Просмотров 8 тыс.
50% 1

Опубликовано:

 

22 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 43   
@bobkoss280
@bobkoss280 4 года назад
I've only used simple aliases - until now. Learned a lot. Thanks.
@thingsiplay
@thingsiplay 3 года назад
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 года назад
I really should try fish
@johnjoyce
@johnjoyce 3 года назад
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 года назад
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 года назад
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 года назад
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.
@p00pyfarter
@p00pyfarter 4 года назад
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 года назад
I can lower it, I've been using it for at least 3 months and you're the first person to mention it
@linuxcaffe
@linuxcaffe 4 года назад
WOW! Good one Brodie! I learned a bunch! Thanks!
@iLiokardo
@iLiokardo 4 года назад
'source .zsh' you could also use 'exec yourshell'
@awabqureshi814
@awabqureshi814 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 года назад
I think to launch chome in macos is: $ open -a "Google Chrome"
@willson3239
@willson3239 4 года назад
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.
@scorch855
@scorch855 3 года назад
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.
@iLiokardo
@iLiokardo 4 года назад
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.
@umka7536
@umka7536 4 года назад
I use normal and suffix aliases in zsh.
@tapank415
@tapank415 4 года назад
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 года назад
how portable is `$OSTYPE`, especially compared to `uname`?
@humm535
@humm535 4 года назад
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.
@bobkoss280
@bobkoss280 4 года назад
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 года назад
I've never really thought about fixing it but it could make an interesting video
@qawsfgtwgshsghsfdvf
@qawsfgtwgshsghsfdvf 4 года назад
How about a keybinding follow up in zsh using tmux. I dont like typing my alias.
@BrodieRobertson
@BrodieRobertson 4 года назад
I do need to take a proper look into tmux
@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.
@arvindhn036
@arvindhn036 4 года назад
You don't have to type source everytime. Alternatively, you may use . ~/.zshrc
@BrodieRobertson
@BrodieRobertson 4 года назад
Thanks, I didn't know about that
@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 4 года назад
Thanks, RU-vid apparently doesn't tell you when you get a new member, I only just checked the list.
@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.
@TrueWordsOfEternity
@TrueWordsOfEternity 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
Далее
Curl: You Already Have A Tool For Testing REST APIs
12:28
Zsh & Fish Are A Trap: Learn How To Use Bash First
11:10
Let's Share Our Favorite Bash Aliases
16:28
Просмотров 31 тыс.
Best PS1 Emulator Just Became Proprietary Software
15:37
Fish Is A Modern Shell For The Sophisticated User
15:56
Was Rust In The Linux Kernel A Mistake?
26:09
Просмотров 133 тыс.
Top 10 Oh My Zsh Plugins For Productive Developers
17:23
How A Steam Bug Deleted Someone’s Entire PC
11:49
Просмотров 996 тыс.
A Proper Zsh Video
20:40
Просмотров 10 тыс.
What is the Smallest Possible .EXE?
17:04
Просмотров 394 тыс.