My shell setup with Fish and Tmux (2021)
milanvit.net
milanvit.net
Researched a bunch of themes/prompts, initially wanted oh-my-posh (which Hanselman uses), then Starship.rs because it was fast, then powerlevel10k because it was faster, then saw opinions in favour of Fish over Zsh, sidetripped to r/UnixPorn along the way, and finally settled on Fish + Fisher (plugin manager) + Tide (a Fish port of powerlevel10k) + Catppuccin Fish (a pastel theme). The configuration wizard in Tide makes it very simple to pick the prompt's design and colours, and further customisation is easy too. Quite a rabbithole, but I'm pretty satisfied now!
Now I just use fish + starship and don't mess around with packages
fisher install PatrickF1/fzf.fish fisher install urbainvaes/fzf-marks
# These two to get sdkman and nvm to work in fish, IIRC fisher install reitzig/sdkman-for-fish@v1.4.0 fisher install jorgebucaran/nvm.fish
> Sponge quietly runs in the background and keeps your shell history clean from typos, incorrectly used commands and everything you don't want to store due to privacy reasons.
___
Also here is a nice list you can take a lookt at: https://github.com/jorgebucaran/awsm.fish
for me syntax, search and autosuggestions are the key features of fish which no other shell has and starship doesn't seem provide those.
for consistent shell across os i recommend zsh (mingw on windows), or nushell or fish.
One thing I personally like very much is that it supports a command line tab and pane navigation/management : https://github.com/cassepipe/dot-git/blob/8b300524021cc74f67...
So it's great -- for me -- for local connections, or remote ones where I don't need to pass an SSH agent, but it's not yet there "fully" for me the way KiTTY is.
Why doesn't Terminal.app qualify? I used to use iTerm 2 because I liked its pane management, but after switching to using tmux several years ago, I've solely used Terminal.app + tmux without any issues in my workflow. What am I missing out on?
https://apple.stackexchange.com/questions/48796/iterm-as-a-s...
The latency of iTerm has traditionally been much worse than Terminal.app. It got a bit better with GPU rendering, but it still trails behind Terminal.app quite a bit.
https://danluu.com/term-latency/
https://www.lkhrs.com/blog/2022/07/terminal-latency/
I tried iTerm for a while because Terminal.app does not support true color. But the difference in latency is definitely noticeable to me.
One of my colleagues at my first job didn’t even have a direct connection to the mainframe when he started. He used to write his code on paper, get a typist to then enter that into the mainframe and he would get the output a day or two later. Which meant he had to put a lot more care into checking for syntax errors before handing the code off to be entered and compiled.
If you are curious: https://jmmv.dev/2015/09/my-coding-workflow.html
The pattern is always the same: I read an amazing article on how fish makes X easier/fancier than bash/zsh, I install it again, I spend half a day trying to export my two decades of bash/zsh customizations, and eventually I just give up overwhelmed by the amount of required work.
Fish is a great shell, but I don't know why they decided to go all the way and completely break the compatibility with anything that POSIX has produced over the past four decades.
I won't rewrite all of my shell functions, aliases, for loops, string concatenations and environment variables to comply with a shell that is only compliant with itself, sorry. And I don't know why they decided to go the nuclear way and break compatibility so hard where they could have at least guaranteed a back-compatibility layer with (at least) zsh. Reinventing the whole wheel to make it look exactly the way you want, while disregarding compatibility with everything that already exists, is probably the biggest violation of the UNIX philosophy.
compatibility should be limited to interoperability. but it should not limit how we can design our tools.
and the tools do adapt. more and more of them work just fine with fish. maybe some day in the future your tools will work with fish too.
I spend half a day trying to export my two decades of bash/zsh customizations
don't. if you switch to fish, you should not want/need those customizations, because if you want to make fish look or work like your old shell, why are you even switching? you are learning a new environment with new features. get used to fish as it is first. after a while you may discover fish's own customization options, and the many tools that provide customizations across multiple shells. your own handcoded adaptions are probably not even portable to any other shell.
Reinventing the whole wheel to make it look exactly the way you want, while disregarding compatibility with everything that already exists, is probably the biggest violation of the UNIX philosophy
fish is not reinventing the wheel. it is creating new wheels with features that we never had before.
the popularity of fish just shows that this incompatibility is not a problem to many. if it were, fish would be dead by now. other shells are gaining ground that also break compatibility and maybe we'll find a future where these compatibility issues are not issues anymore because we will have learned to build environments that don't depend on that compatibility.
it's much more intuitive (foo) is clearly a command and > and < are in and out respectively. if i look at (foo | psub) i am wondering what that is supposed to mean.
Put them in ~/bin, then you can use them regardless of the shell you're using.
Of course, if the shell function or alias needs to modify the shell state, then it won't work as a shell script.
Also, I wonder how fast is OMF compared to Starship?
. venv/bin/activate.fish
For stuff like "in this directory, I want this virtual env activated", I'd recommend using direnv.
> wondering whether some command you just ran silently did something wrong because of shell incompatibility
I don't recall running into silent incompatibities. Do you have examples in mind?
Although, yeah, you can't just copy-paste most sh/bash snippets into fish.
I have the impression that you just overlook all the rest of the things that can go wrong when using Bash, because you are simply used to it, you know it and you know how it will behave. In the sense that with Dash you would perhaps have a similar problem. Fish is really pleasant and forgives a lot.
> Also, I wonder how fast is OMF compared to Starship?
Those are two total different projects. During my hypomania on Fish (yup), I didn't even use OMF, but added things manually and only those really needed, so that there was as little code to maintain as possible. Fish does not have a huge number of scripts, plug-ins. If Starship is too slow for you, you might like Tide. I found nothing more interesting, after which I returned to Starship anyway, but it's really fast.
https://github.com/IlanCosman/tide
Perhaps you don't need something faster than Starship, just to configure Fish in such a way that it cleans itself of garbage and runs asynchronously?
I don't write much of bash or fish, I mean scripts written by others. Encounter cryptic error messages then realize script is just assuming shell is POSIX
> Starship is too slow
Starship plenty fast for me. You say it's completely different than OMF but from what I see they both exist to customize your prompt, no?
I run most of my scripts in Bash, but what I can, I convert to Fish. If the advantages of Fish are less important than POSIX compliance, I won't suggest anything, because I have no need to be POSIX compliant, so maybe I don't really have the same concerns. :)
> Starship plenty fast for me. You say it's completely different than OMF but from what I see they both exist to customize your prompt, no?
Forgive me, I mistakenly assumed you meant that Starship runs too slowly. It depends on how you define prompt. Strictly it will be whatever is shown in the terminal when it waits for user input. OMF is a multi-tool that, in addition to modifying the appearance, acts as something like a plugin manager. Starship gives you "just the look". I think a good analogy would be to compare systemd and runit in 1 category.
it's only work if the commands need to be run within fish itself and not a subshell. there are tools for that but i agree that sometimes i can't be bothered and then i'll just work in bash to do that job.
#!/usr/bin/env bash
which works regardless of the executing shellIf it's something you're trying to `source` then it can go wrong, but `bass` takes care of that if it's a POSIX-compatible script being sourced. If it's some other sort of script being sourced (PowerShell, NuShell, etc) you can have issues, though `fish` will usually fail to parse it and exit with error.
source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh
source /usr/share/zsh-abbr/zsh-abbr.zsh
(In case it's not clear, install them with your system package manager.)my favorite part besides autosuggestions is the way history works, not incremental but i can type out a search term, and then start searching up and down the history.
incremental search is always irritating me by showing me irrelevant stuff while i am still typing, which i find distracting because i have to process it while at the same time focusing on typing the search term right.
now if only i could also have multiple search terms...
(i also prefer the fish syntax, but that is more of a matter of taste and getting used to)
IMO one of the biggest advantages of zsh is it's almost 100% compatible with Bash. If I'm in my shell and want to run an adhoc command with a for loop I want to do it with Bash's syntax, not learn a new Fish syntax. Having to manually drop into `bash` to run a bunch of commands is too inconvenient. Also you'll find most examples online using POSIX shell or Bash compatible syntax. You can carry over those to your dedicated scripts and adhoc commands. Your knowledge becomes shared.
It is more lightweight than zsh, fish, or bash and comes with a decent auto-completion and line prediction a-la fish.
For my prompt, I am using polygot [1]. However, I am looking for another one.
I was previously a zsh user. I already tried fish, however, its non-POSIX-compliance was a hard stop for me.
I can tell it’s done if I have a tab open looking at the logs, but ideally I’d like some kind of icon that’s yellow when compiling, green when compiled, etc.
What could I use for that?
tmux will also show you the name of the command that's currently running, so if it's a make file or other script that finishes, you can observe that on it's own, but if you add an `echo -e "\007"` to the end of your script, you'll get the indicator.
There’s a way to hook into the build process and run commands after it completes. I’m guessing I might have to do that to get the status line wired in.
if you want to hack a bit and have a specific log line outputted yo the terminal you can stuff the bell char right in the string!
one could also display notifications, there are more advanced CLI programs but here's a crude way: https://apple.stackexchange.com/questions/238814/send-notifi...
These things can also be done on Linux. A bit of web searching should give you ideas.
I frequently use them with long running commands or fswatch.
I would suggest you keep it simple and simply poll the logfile for the latest occurrence of either "Build started" or "Build finished" and display a pop-up for each case.
Very roughly that would look like:
while true
do
MATCH=$(ssh remote@host 'cat /logfile' | grep -P 'started|finished' | tail -1)
case "$MATCH" in
*started*)
notify-send "Build started"
;;
*finished*)
notify-send "Build finished"
;;
esac
sleep 1s
done
That's dirty bash written in an HN comment on my phone, but the idea is here. It's a bit wasteful to initiate ssh sessions so often, so you could improve it with a single "ssh remote@host tail -f /logfile", pipe that to "grep", then to a while read, but I left that as an exercise.There is some option to notify-send so that pop-ups replace one another instead of creating new ones.
Was exactly what I wanted, thanks.
make install; printf \\a\\a\\aI alias the build command to POST a notification using curl and get it on the browser/phone