79 points · by behnamoh · 4y ago · 49 comments
Syntax highlighting is useful as well, though that requires the use of a third party plugin. You can detect quoting errors, unmatched braces, missing commands, incorrect filepaths before hitting enter. It's indispensable in an interactive shell because that's where you write convoluted one-off one-liners.
ZLE, the zsh equivalent of readline, is also a major selling point. It allows you to create your own keybinding widget, a shell function bound to a key that can manipulate the current command line buffer. It's what enables the syntax highlighting plugin. With readline, you can only assign predefined functions.
In general, zsh is extensible and offers more capabilities than bash. But to feel the difference, you need to configure it and enable the nice features.
It also didn't preserve bash's builtin functions which just means I have to learn its functions but when in a bind I just fire up bash and use it instead. The popularity of bash means scripts I write will almost always be for it as well, not gonna ask others to switch to zsh to run my scripts.
That said your points are very good. Like I said initially, I wish there was a script to fix all these annoyances, like a sibling comment mentioned how to fix the ! command recall.
bindkey '^I' expand-or-completeThe joke here is: All this requires additional scripts / configs. Whether bundled or not…
With those scripts / config there is no difference between shells.
> Syntax highlighting is useful as well, though that requires the use of a third party plugin. You can detect quoting errors, unmatched braces, missing commands, incorrect filepaths before hitting enter. It's indispensable in an interactive shell because that's where you write convoluted one-off one-liners.
https://github.com/akinomyoga/ble.sh
> In general, zsh is extensible and offers more capabilities than bash.
Nobody ever could show me even one feature that isn't available in almost all popular shells!
> But to feel the difference, you need to configure it and enable the nice features.
Yeah sure. When you tune your ̵c̵a̵r̵ shell it has nice features afterwards…
That's true for any shell as I see it.
---
I for my part don't like Unix shell. Even after 20 years of usage (as since then Linux is my only OS).
Also I've never understood what's the case about zsh. Nobody could ever answer the question why it's anyhow "better" or even show features not available elsewhere.
I came to the conclusion that zsh is just a stupid hype of "cool kids". It's the same as with the car tuning crowd.
A truly better shell would be much different than a Unix shell. There are some experiments out there but nothing really convincing.
So I continue to stay with the not so cool default. As it's most compatible and available everywhere.
But please wake me up when there is some real innovation regarding shells!
You mean a single line.
autoload -Uz compinit; compinit
> With those scripts / config there is no difference between shells.As I wrote in my original comment, bash only does filepath completion most of the time even with third party completion scripts. And I have never seen bash completion provide descriptions alongside subcommands or CLI options.
> https://github.com/akinomyoga/ble.sh
ble.sh is impressive work, but it's a hack that won't be as reliable or compatible without built-in support for programmatic manipulation of the command line buffer in bash. ble.sh works around bash limitations by diverting key input from readline and reimplementing its features. It contains workarounds for specific terminals, and scripts have to be modified to accommodate ble.sh. IIRC FZF's shell integration required modifications to work with ble.sh.
> Nobody ever could show me even one feature that isn't available in almost all popular shells!
Read the parts of my original comment which you haven't quoted.
> When you tune your ̵c̵a̵r̵ shell it has nice features afterwards…
Only to the extent that the shell lets you. Also, having features bundled in the default installation helps tremendously even if it's not enabled by default.
> I came to the conclusion that zsh is just a stupid hype of "cool kids". It's the same as with the car tuning crowd.
That was uncalled for. If you don't want to use zsh, that fine but don't assume things and throw insults at those who do.
> But please wake me up when there is some real innovation regarding shells!
The original comment was about how zsh compares to bash, not a critique of the unix shell.
0. Does `source ~/.config/.prompt` exist in .zshrc? if not, make it so.
1. If `~/.config/.prompt` is empty, give me a cool default prompt
2. print a link to the gallery of things I can put in `~/.config/.prompt` to make my prompt look different.
don't do any "hey lets do our biweekly upgrade" don't do anything fancy, I don't care about the rest. just give me a predictable prompt with a name I can remember, and let people submit theirs.
I think it is appropriate to mention WezTerm.
The cross-os terminal emulator with multiplexing and is instant startup on windows as compared to seconds for Windows Terminal or iTerm2.
It allows for a consistent terminal setup across Windows, macOS and Linux.
(Thing like that are what set iTerm apart for me, and why I keep going back to it...)
It's my goto on linux now, and I even installed in on my Mac where I'm daily driving Warp.
pan-OS
ohmyzsh - mostly for the git aliases :D
starship - contextual prompt
AstroNvim - this replaced SpaceVim for me - a delightful- batteries included vim
direnv - directory-based environments - I have custom layouts that install python with pyenv, and a virtualenv with pyenv-virtualenv, and activates the VE based on the .python-version
RipGrep - replaces ag for search
k9s - for managing kubernetes
hishtory - command history search
lsd - colorful ls replacement in rust
bat - colorful cat replacement in rust
brew - so much fresher than apt packages on linux
OSx
Warp - next gen terminal - replaced iterm for me
Linux
Wezterm - really snappy terminal emulator
Don't turn your shell into unicorns and rainbows. They won't be there when you need them. Turn yourself into someone who can be productive with the basic Bash defaults because those are the only things that will definitely be there on every system you use.
It is not an argument to keep the environment I work in all the time dumb.
Want to customize your prompt? Write a function called "fish_prompt" that calls git, echo, or whatever else you want and make them write to stdout. There, done.
Want to add a second prompt column to the right side of your shell? My "fish_right_prompt" function looks like
set_color 666666
date +'%Y-%m-%d %H:%M:%S'
set_color normal
and it puts the date at the end of each command prompt.Have spaces in filenames? Watch this:
$ touch a "b c" d
$ for i in *; echo "<$i>"; end
<a>
<b c>
<d>
Of course it handles that for you automatically.The downsides are that it's not POSIX-compatible, that command lines you find online may or may not work in it, and it's not going to be installed on every machine you touch. However, 1) you can still use bash or zsh if you occasionally need to, and 2) why make your life harder if you're using a machine you can install software on 99% of the time? I mean, I still write Python, even though it's not installed everywhere by default.
$ touch a "b c" d
$ for i in *; { echo "<$i>" }
<a>
<b c>
<d>
Once I added 'zsh-syntax-highlighting' and 'zsh-autosuggestions' I didn't see a reason to deal with all the eccentricities of a non-standard shell like fish.(If anybody is looking for a terrific "turn-key" zsh config that is fast, check out https://github.com/romkatv/zsh4humans/tree/v4 ... there are instructions for trying it out in Docker so it won't mess with your existing shell config.)
> Note in particular the fact that words of unquoted parameters are not automatically split on whitespace unless the option SH_WORD_SPLIT is set; see references to this option below for more details. This is an important difference from other shells.
https://zsh.sourceforge.io/Doc/Release/Expansion.html#Parame...
The example works the same in Zsh. (of cause with the slightly different for loop syntax)
for i in *; do echo "<$i>"; doneIn Fig, adding a plugin is easy as clicking a button. And if you have issues with it, you can uninstall in a click too
Most apps make it easy to tweak themes, but it'd be nice to not have to do so.
I appreciate the details about the current environment it puts in the prompt. e.g. the current git branch, which AWS profile / region is active, etc.
But I do agree that it's excellent.
For example, in AstroNvim - the path completion dropdown shows icons and all paths accessible, when focusing on a file, it shows the head of the file. It's a really smart UX integration. It would likely have taken me weeks to months of playing with my config to have a small subset of what is available in the distro.
They're also very configurable, so you can override any key-binding you want, add or disable plugins.
I guess it depends on how you want to spend your time :shrug
SpaceVim has a really slick install and gives me all the LSP and a nice collection of plugins. And someone else is maintaining it!
I'm guessing newer shells may have better support for this kind of thing instead of running shell commands to wrangle text files on every prompt.