It clears the previous command output every time before new command executed in shell.
Using: iTerm2 with status bar enabled and theme Snazzy, Fira Code font, starship for the prompt and of course, fish. Almost no configuration or fine tuning is required!
Once installed, this plugin creates a function that gets triggered before the execution of the command thanks to the --on-event fish_preexec
. This event is documented here.
The function clears the previous command output and redraws the fish_prompt
with the executed command.
Ergonomics.
On a laptop, bending in order to look down at the bottom of the screen might cause problems to the neck. If, like me, your vision is not 100%, this can help when staring at the terminal for extended period of time.
Inspired by almostontop plugin for zsh by Valiev which is inspired by alwaysontop plugin for bash by swirepe.
Suggestion: Use fisher which is a very clean and easy way to manage plugins.
fisher add veggiemonk/almostontop-fish
Or install it manually
curl https://raw.githubusercontent.com/veggiemonk/almostontop-fish/master/conf.d/almostontop.fish --create-dirs -sLo ~/.config/fish/conf.d/almostontop.fish
The plugin is automatically load as it is located in ~/.config/fish/conf.d/
To deactivate the plugin in the current session, remove the function:
functions -e almostontop
To reactivate the plugin, open a new shell or source
the code :
source ~/.config/fish/conf.d/almostontop.fish
Check https://fishshell.com
or
brew install fish
echo /usr/local/bin/fish | sudo tee -a /etc/shells
chsh -s /usr/local/bin/fish # set it as the default shell
fisher rm veggiemonk/almostontop-fish
# or
rm ~/.config/fish/conf.d/almostontop.fish
If you don't want to install the plugin, just copy-paste these 5 lines into your config.fish
. Although, it is better to put it in conf.d
folder.
function almostontop --on-event fish_preexec
clear
fish_prompt # draw prompt
echo $argv[1] | fish_indent --ansi # colorize executed command
end
Implementing a toogle feature.
Although I've never used that feature, so this feature might never be implement. Comments, ideas or pull requests are very much appreciated. :D