Sweet Shell: With Oh-My-Zsh, SpaceVim, Starship, True Color, and Demo Mode
bretfisher.com
bretfisher.com
set +o histverify
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.
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"…
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.
It's my goto on linux now, and I even installed in on my Mac where I'm daily driving Warp.
(Thing like that are what set iTerm apart for me, and why I keep going back to it...)
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.)
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.
setopt prompt_subst
PROMPT='$(whoami)@$(hostname): $(pwd) \$ '
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.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.
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.> 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.