Skip to content

HOW_THIS_WORKS

Simon Fowler edited this page Jun 30, 2017 · 1 revision
  1. summary What needs to happen to make this work.

HOW DOES THIS WORK?

This program operates on the assumption that your shell gives you the ability to execute a custom operation before a prompt is redrawn on your terminal.

Bash provides the PROMPT_COMMAND environment variable while zsh gives us the precmd environment function. Both are repurposed by this program to log the previous command into a local database before each new prompt is displayed.

Many people have never heard of this feature or found a great use for it. However, if you currently DO use this feature, you can still use this program. The code renames your existing hook and invokes it after saving the previous command.

\0/ - AWESOME!!!
 Y
/ \
Clone this wiki locally