I can't seem to get myself to like zsh more than bash. I eish there was a bashifier profile script. Small annoyances. A small example would be '!' To execute the last matching command, I use that all the time but zsh requires an extra enter to get it to actually run. I use it when it is a default, sometimes I use bash when it annoys too much and I would not pick it on purpose. I just don't get what is so much better about it.
Autocompletion is one thing zsh does better, and that alone is worth it IMO. It can autocomplete things other than filenames and even gives you a short description for each of the subcommands or CLI options in the completion candidates. For the most common commands, this works without even having to install third party completion scripts. Bash, in comparison, has limited completion. Most of the time, it only completes filenames even after installing third party completion scripts. It's a major source of frustration when I find myself in a bash shell.
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.
Autocompletion is another thing I don't like about it. The way bash does it is consistent with how other older shells did it. I can get over the weirdness but another annoyance there is having to hit the right arrow instead of tab or shift+tab.
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.
zsh's autocompletion is highly configurable, so you can probably make it behave like bash. But I guess using bash would be better if you prefer its style of autocompletion. However, you should be able to use tab key for completion by default. If it doesn't work, maybe the following command can fix it:
> Autocompletion is one thing zsh does better, and that alone is worth it IMO. It can autocomplete things other than filenames and even gives you a short description for each of the subcommands or CLI options in the completion candidates. For the most common commands, this works without even having to install third party completion scripts.
The 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.
> 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!
> The joke here is: All this requires additional scripts / configs.
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.
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.
You're right that all the shell additions are hacks (especially in Bash, as zsh was at least built with extensibility in mind).
But Unix shell is just a gigantic hack anyway…
It's a user interface build on top of a line printer terminal. In this regard all (true) Unix shells are the same, imho.
> As I wrote in my original comment, bash only does filepath completion most of the time even with third party completion scripts.
I don't see this. Almost all commands I use (besides very exotic ones) have competition.
Newer CLI tools come always with competition scripts for all popular shells.
> > 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.
I've read your comment. It's sounds like the things I've heard hundred of times: "Here, look at this nice feature OOTB". In the end it turns out, more or less always, that there is also a config switch or external script for Bash that does the same.
> > 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.
> […] If you don't want to use zsh, that fine but don't assume things and throw insults at those who do.
I did not insult anybody. I said it's a hype (which is imho a fact). And that's not an insult.
Naming people "cool kids" isn't an insult either.
Comparing "shell tuners" with "car tuners" is imho exactly on point. There are a lot of parallels.
"Car tuner" isn't an insult either. It's likely a funny hobby. (But I'm not into it.)
> The original comment was about how zsh compares to bash
Sure. And it was one of the usual "zsh has feature X" comment, where "feature X" isn't any zsh exclusive feature.
I'm quite tiered by such comments by now. It's just a part of the usual hype. When you start digging into it it always turns out that there's nothing special with zsh, and of course all other popular shells support it one way or another.
I've asked hundred of times that someone shows me something truly "magic" about zsh. But nop, there seems just to be nothing. But the imho groundless evangelizing continues…
That's why I call it by now "stupid hype".
And it's not like that I haven't given it a chance!
It took actually years to come to the conclusion that zsh is just a cool kid's hype. All the time before I thought that it's actually me overlooking something important. But no, there is just nothing.
Bash and zsh are exactly the same in my opinion. Just regular Unix shells. But people are fighting over some irrelevant minor differences. It's like arguing whether it's "better" to drive on the left or on the right side of the road. It just doesn't matter! More important is that you're "compatible"…
I think the "fish way" (if we can call it like that) is better for me when you start to type the command you want to run and if you run it before it comes up as opposed to the ! way. Maybe it is only me.
OMZ is slow, been using zinit since it came out because OMZ and antigen were so slow to start up. Recently I found zsh4humans [1] which benchmarks much better than any other solution, is portable, and has everything I need with sane configs.
Yep, I just want it to do my prompt and leave the rest alone. What would be ideal, to me, is a tool that does this:
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.
Out of curiosity, does WezTerm allow you to "Select output of last command" (Shift-Cmd-A) and jump backwards/forwards through your scrollback command-by-command with Shift-Cmd-Up/Down? (And other features that Shell Integration[0] brings along?)
(Thing like that are what set iTerm apart for me, and why I keep going back to it...)
Been using wezterm for a few months now and love it. On Linux I run a bunch of windows under Sway, on my Mac I run it in "mosh+tmux mode" to connect to a session on the Linux box, a "thin terminal".
I've tried lots of these tools. I'm currently doing
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
As someone who does software for a living, I need to be able to SSH onto a box/container/pod and do things. This is ridiculous.
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.
I used to believe this but in fact I spend a vanishingly tiny fraction of my time shelled into random machines running individual commands by hand. I'd rather optimize for the 99% of my time I spend in an environment I can configure to be maximally productive and enjoyable.
We all have different needs.. not everybody is an "SRE" or similar. Some people just use the terminal/shell mainly on their own machine and want to tune it. I am one of them. I can still use a vi without plugins on a remote machine instead of my tweaked and heavily customized vim.
It is not an argument to keep the environment I work in all the time dumb.
I just started to use fish which seems like most of the things oh-my-zsh does but without the hassle. On the down side it has few quirks (loops, wildcards for example).
I switched to fish a couple of years ago and I'd never go back now.
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.
FWIW, zsh can do that stuff (and more!); e.g. set RPROMPT for a "right prompt". It also handles files with spaces just fine:
$ 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.)
In fish, it's literally just a function that runs normal commands. There's no special syntax or anything.
And in any event, that's just an example. Fish feels like it was built to be ergonomic and convenient. It's also lightning fast because all of the nice things are built-in and don't have to be accreted around it.
In other words, zsh uses format strings. You don't need to use the format specifiers, it's just there for convenience so that you won't need to spawn a bunch of processes to do trivial stuff. Here's one example that is very much ergonomic and convenient as the fish way:
Things don't have to be "accreted around" in zsh either. It has a powerful completion system, convenience commands and keybindings built into it. It can do pretty much what people want from fish sans the syntax. It's just that there are an abundance of plugins and frameworks around zsh because it was designed to be extensible from the ground up. Some of those frameworks do slow down the shell, but that's a problem with that particular framework, not inherent to how zsh works.
I highly recommend installing Fish and experimenting with it for a couple of days, if only to see what a different approach to shell design looks like. Don’t try to make it into a Zsh clone, but use it as itself and see what you think.
If you do that, I suspect you won’t find that prompt_subst is a good replacement for being able to write full-blown functions that allow complex flow logic like “if logged in as root…” or “if this is a Git directory…” or “if the last command succeeded…”. Yes, you can do all of those in Zsh in the sense that both shells are Turing complete, but wow, it’s nice when the shell makes it easy and fun to do these things.
You can write full-blown functions for displaying prompts just as easily.
prompt_custom() {
if (( EUID == 0 )); then
printf '# '
else
printf '$ '
fi
}
setopt prompt_subst
PROMPT='$(prompt_custom)'
or more commonly,
prompt_custom_precmd() {
if (( EUID == 0 )); then
PROMPT='# '
else
PROMPT='$ '
fi
}
add-zsh-hook precmd prompt_custom_precmd
I do occasionally check the fish repo for status updates, but decide not to make the switch because of syntax incompatibility concerns and lagging vi keybinding support. Those are issues that I would encounter on a daily basis if I were to use fish.
Spaces in filenames is more a Bash problem. Zsh does far less automatic word splitting.
> 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.
We built the Shell Plugin Store into Fig[https://fig.io] to solve a lot of the problems mentioned in this thread. Namely:
* Plugins are hard to install/uninstall
* Plugins are hard to customise once installed
* Plugins add bloat and/or degrade performance in shell load time
* It's hard to find plugins in the first place (there is not centralised directory)
* It's hard to sync plugins and configurations across devices
In Fig, adding a plugin is easy as clicking a button. And if you have issues with it, you can uninstall in a click too
Are there any good, broadly available color themes where the background is actually black? OLED screens are incredible, but for screen maintenance and because it looks incredible you want your background color to be actual black rather than almost black.
Most apps make it easy to tweak themes, but it'd be nice to not have to do so.
mostly because you can spend an arbitrary amount of time tweaking your vim to get it the way you want it. This Vim distros, like SpaceVim and AstroNvim, are a great foundation working on an IDE-like vim setup.
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
I used LunarVim, switched about 6 months ago because I was tired of maintaining my virc settings that I'd been carrying around for decades and a bunch of plugins.
SpaceVim has a really slick install and gives me all the LSP and a nice collection of plugins. And someone else is maintaining it!
A thing to do with your environment setup, so a tool I suppose? There are probably different plugins out there for it. In my case it's a few lines in .bashrc that override the history processing to never delete old history, and add tags indicating which session wrote the command. This way I can reboot a computer, restart all 30 screen sessions, and have each access backward searchable history to the start of time (2013 for me).
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.