Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nyoungstudios/zsh-history-on-success
Zsh plugin for filtering the commands saved to your zsh history file
https://github.com/nyoungstudios/zsh-history-on-success
oh-my-zsh-plugin ohmyzsh zsh zsh-history zsh-plugin
Last synced: 10 days ago
JSON representation
Zsh plugin for filtering the commands saved to your zsh history file
- Host: GitHub
- URL: https://github.com/nyoungstudios/zsh-history-on-success
- Owner: nyoungstudios
- License: apache-2.0
- Created: 2024-10-27T06:13:35.000Z (17 days ago)
- Default Branch: main
- Last Pushed: 2024-10-29T04:14:28.000Z (15 days ago)
- Last Synced: 2024-10-29T06:28:13.414Z (15 days ago)
- Topics: oh-my-zsh-plugin, ohmyzsh, zsh, zsh-history, zsh-plugin
- Language: Shell
- Homepage:
- Size: 6.84 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# zsh-history-on-success
> Zsh plugin for filtering the commands saved to your zsh history file
Save yourself from repeating the same mistakes by filtering out your unsuccessful commands from your zsh history file.
The original code was written by [Dean Scarff](https://github.com/p00ya) from this [blog post](https://scarff.id.au/blog/2019/zsh-history-conditional-on-command-success/). Some further features have been added.
## Features
1. Saves commands that exited successfully to your zsh history file.
1. Saves commands that exited with Ctrl+C and have been running for longer than the Ctrl+C duration (configurable with environment variables). Useful for saving commands that do not exit like running a web server.## Install
Run this command to install this plugin if you are using [Oh My Zsh](https://github.com/ohmyzsh/ohmyzsh).
```bash
git -C "${ZSH_CUSTOM:-${ZSH:-$HOME/.oh-my-zsh}/custom}/plugins" clone --depth=1 https://github.com/nyoungstudios/zsh-history-on-success
```## Configuration
This plugin can be configured with environment variables.
- `ZSH_HISTORY_DISABLE_CTRL_C_SAVES`. If set to `true`, commands that exited with Ctrl+C and have been running for longer than the Ctrl+C duration will not be saved to your zsh history file.
- `ZSH_HISTORY_CTRL_C_DURATION_MINUTES`. This is the threshold for the number of minutes that a command has been run for when the Ctrl+C signal was received must meet before it will be saved to your zsh history file. The default duration is 10 minutes.
- `ZSH_HISTORY_CTRL_C_DURATION_SECONDS`. Use this if you prefer to set the number of seconds. This is the threshold for the number of seconds that a command has been run for when the Ctrl+C signal was received must meet before it will be saved to your zsh history file.