Moving to zsh
- 698 words
- 4 min
I recently transitioned away from the
ion shell to
zsh, and I figured it might be a good idea to float some of the advantages and disadvantages that I've found during this time.
- Mostly POSIX compliant.
I'll touch on this more later, but in general the ability have portable scripts that work across systems and shells has been incredibly useful - especially as I expand the number of machines I use and prepare to start working after finishing my masters. For those wondering,
ionis explicitly not POSIX compliant.
- I can reclaim the
@symbol and not worry as much about quoting
This is a part of
ion's lack of POSIX compliance, and it claims the
@sigil for use in array specific functions and variables. I've generally found throughout my use of
ionthat I use array variables much less than I do the
@sigil, and getting it back for
gitand the like has been a major boon.
(It isn't so much that I'm against arrays per say, just that I'd prefer that it somehow reused a symbol that's already typically used by shells instead of nomming another character)
- Its much easier to get setup on new computers.
I've just put Alpine Linux on a Raspberry Pi 2B, and have begun migrating some recurring tasks to its crontab. Last time I checked,
ionstill had some issues building on arm-based platforms, so unfortunately I can't quite port my dotfiles to it. I've also recently completed my masters and will begin working in the middle of January. Knowing the company that I'm working for, there's a chance that I might be getting one of the new-fangled Apple Silicon Macs, and at the time of writing this post, there are still issues with porting even just the Rust compiler to the new platform.
Oh boy this is a big one.
ion"has" completion, in that you can tab complete files and commands. What it doesn't have - however - is the ability to tab-complete arguments (which can be an absolute life-saver) nor other more specific completions such as man pages.
- Slower start times.
I open a lot of shell prompts - anyone who basically lives in the terminal and incessantly uses
tmuxdoes. Something that I've definitely noticed is that the time it takes to open a new window or prompt is much lower with
ionthan it is with
zsh- and indeed hyperfine backs this up. An invocation of
hyperfine 'zsh -i -c ". ~/.zshrc; exit"'takes around 70ms (with approximately half of that being completion pre-processing), whilst running
hyperfine 'ion -i -c "source ~/.config/ion/initrc; exit"'only takes around 20ms. And that's despite my
ionconfig doing more than
zsh's as well as not being as well optimised.
- Visible history completion.
One of my favourite features of
ionis that (similar to
fish) it shows you the most recent matching command in your prompt. As of yet, I haven't been able to figure out a way enable a similar behaviour in
zshwithout loading an extension module, which has me weary due to the potential additional startup latency I might end up with.
I think I'm probably going to stick with
zsh until I find a better shell to move to.
mrsh seems like a great idea of something to move to eventually, especially as
dash will likely never implement any form of completion, whilst
imrsh names good completion as one of its goals.
Interestingly, one of
ion's major advertised features - its inbuilt data structures - are actually something that I've found myself rarely using, especially whilst actually at the shell.
I usually find that should a hashmap or the like be required, then that script should probably be converted to a language like Python, even if only for clarity and the rich inbuilt libraries.