Skip to content

Latest commit

 

History

History
33 lines (28 loc) · 749 Bytes

README.md

File metadata and controls

33 lines (28 loc) · 749 Bytes

chrono

Installation

wget https://github.com/mikemackintosh/chrono/releases/download/v1.0.6/chrono-linux-amd64
sudo cp chrono-linux-amd64 /usr/local/bin/chrono
sudo chmod +x /usr/local/bin/chrono

Then, with zsh you can use it by adding the following to your .zshrc:

_preexec_chrono() {
  export START_TIME=$(chrono -m)
}
preexec_functions+=(_preexec_chrono)

_precmd_chrono() {
  CHRONO_DURATION=$(chrono)
  unset START_TIME
}
precmd_functions+=(_precmd_chrono)

And then call the $CHRONO_DURATION variable in one of your prompts, such as:

precmd() {
  RPROMPT="%B%F{215}${CHRONO_DURATION}%f%b"
}