When comparing zsh vs Hammerspoon, the Slant community recommends Hammerspoon for most people. In the question“What are the best power user tools for macOS?” Hammerspoon is ranked 36th while zsh is ranked 50th. The most important reason people chose Hammerspoon is:
Hammerspoon's Lua scripting and broad API allows you to perform any action you can imagine on your mac. It hooks into many OS APIs directly and has some high-level APIs to manipulate things like Spotify or iTunes. See the full list [here](https://www.hammerspoon.org/docs/).
Ranked in these QuestionsQuestion Ranking
Pro Interactive autocompletion
When you start typing a command, you can press the tab key and it will complete the command you started typing. If there are multiple potential commands, you can choose which one to run by simply pressing tab again. Case-insensitive by default, too.
Pro Autocomplete for options
Zsh intelligently determines if you are trying to complete a file path or an option, and pressing tab after typing
- will reliably bring up a list of options.
Pro Powerful community-driven tools via oh-my-zsh
Oh-my-zsh is a community-driven framework, which helps users with their zsh configuration and plugins. 400 plugins, 200+ themes and auto-updates to always be up to date.
Pro Good bash compatibility
Things you've learned using bash will largely apply to zsh. Scripts written in bash will run with little to no modification.
Pro Shared histories
If you spend a lot of time in the terminal, most likely you will have several terminal windows open. Zsh has great support for command line histories. The history is unique and shared through all the different instances.
Pro Recursive globbing
ls **/*.log for example is supported by ZSH.
Pro Pipe output to a temporary file:
Some programs don't support loading from stdin, but ZSH can store outputs to a temporary file, example:
unzip =(curl http://example.com/someZipFile.zip)
Pro Smart escaping
Zsh can determine the context of the command you're typing in and determine if it should escape characters if you're typing in a URI.
Pro Great install procedure
Zsh will take you through a procedure which is roughly 30 minutes in length before during install. Through this procedure it asks you to set different options and customize the shell the way you want it to. Most of these settings are also found in other shells, but to customize them you have to go dig configuration files while zsh allows you to do it in the beginning.
Pro Faster spelling correction
Zsh' s correct (or correctall) is vastly superior to Bash's attempt at spelling correction.
Pro Deeply customizable
Hammerspoon's Lua scripting and broad API allows you to perform any action you can imagine on your mac. It hooks into many OS APIs directly and has some high-level APIs to manipulate things like Spotify or iTunes. See the full list here.
Pro Automate actions based on the operating system
Hammerspoon lets you hook into OS level events and trigger any action you can imagine. From setting up a simple keyboard shortcut to launching a complex workflow using multiple apps and scripts.
Con Defaults are unfriendly for a long-time bash user
Expect to find a configuration you like (or use the configuration utility) to set reasonable preferences. Default zsh interaction is different enough to make you stutter through what used to be familiar workflows.
Con Requires a lot of configuration to be used fully
Zsh requires a lot of tinkering with configuration files and downloading plugins in order to be able to do tasks which other shells may be able to do out of the box.
Con Not fully compatible with bash
There is a small chance you may have a bash script that doesn't work in zsh, although this is very very rare and most developers will never run into any issues.
Con Some knowledge of programming required
Hammerspoon is scripted in the Lua programming language, and some familiarity with programming in general will be needed to use it. Some plugins exist that can be used by adding some files to a specific folder, but this will not give the flexibility that is so key to Hammerspoon