Fix your posture with almostontop
In this post, I'm going to introduce a shell plugin that's been improving my
terminal experience for over a year now:
almostontop
. If you do most of your
work in the terminal, this plugin might be a life-saver for you. It was for
me.
So what does it actually do? It's pretty simple: every time you enter a command in the prompt, it'll clear your screen! This effectively keeps your prompt "on top" (hence the name).
Here's a quick video demo:
With almostontop
, you can stop having to crane your neck downwards while
you're working. The change might look small (even a bit superfluous), but it's
been a huge help for me.
Installing
almostontop
is a zsh plugin. If you're a
bash user, you can use
alwaysontop
, which does the same
thing. If you use a different shell, you'll probably have to figure out
something different (see the other shells section of this
post).
If you're a zsh user, here are two ways you can install almostontop
:
Installing Raw
At the most basic level, visit the GitHub repository and download:
_almostontop
almostontop.plugin.zsh
version
Put those files in a unified directory; you'll need to access it later. I
recommend something like ~/.zsh-plugins/almostontop
, so you can put other
plugins in .zsh-plugins
if/when you want them.
Now, you'll need to edit your ~/.zshrc
to run the plugin when zsh starts up.
This is as simple as doing the following:
$ echo "source ~/.zsh-plugins/almostontop/almostontop.plugin.zsh" >> ~/.zshrc
If you restart zsh, the plugin should be working! If it doesn't, make sure
that the $ALMOSONTOP
environment variable is set with the following:
$ echo $ALMOSONTOP
true
Yes, the misspelling is intentional. If it's not set or false
, run
almostontop on
.
Installing with oh-my-zsh
If you have oh-my-zsh, the installation is (slightly) easier. Download the repository and do the following:
$ mv <DOWNLOAD_PATH> $ZSH_CUSTOM/plugins
And then in your ~/.zshrc
, add almostontop
to your plugins:
plugins=(
# ...
almostontop
# ...
)
Restart zsh
, and everything should be working!
Other Shells
As far as I know, only zsh and bash have plugins for this. However, you can easily emulate this behavior by taking advantage of "post-prompt" hooks that shells usually have.
For example, see this issue in the fish shell repository.
There are caveats to this, however, so the result won't be as clean as it is with zsh and bash.