{"id":15113831,"url":"https://github.com/minoritea/history-watcher","last_synced_at":"2026-01-18T19:01:54.689Z","repository":{"id":45412481,"uuid":"153754054","full_name":"minoritea/history-watcher","owner":"minoritea","description":"Accelerate bash/zsh history search","archived":false,"fork":false,"pushed_at":"2025-03-21T04:57:15.000Z","size":40,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-21T05:22:16.742Z","etag":null,"topics":["bash","bash-history","command-history"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/minoritea.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-10-19T08:51:52.000Z","updated_at":"2025-03-21T04:57:00.000Z","dependencies_parsed_at":"2024-06-21T08:36:09.892Z","dependency_job_id":"aa9f21a6-b481-4bd0-8877-bb27d94365a4","html_url":"https://github.com/minoritea/history-watcher","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minoritea%2Fhistory-watcher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minoritea%2Fhistory-watcher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minoritea%2Fhistory-watcher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minoritea%2Fhistory-watcher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/minoritea","download_url":"https://codeload.github.com/minoritea/history-watcher/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247378140,"owners_count":20929296,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash","bash-history","command-history"],"created_at":"2024-09-26T01:23:27.746Z","updated_at":"2026-01-18T19:01:54.682Z","avatar_url":"https://github.com/minoritea.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# history-watcher\n\n`history-watcher` is a tool designed to optimize and enhance the command history experience in bash/zsh by addressing common issues faced by power users. This tool aids in efficiently searching through a large command history by integrating with other fuzzy finders.\n\n## Problems Solved\n\n- **Performance**: Improves the speed of history retrieval in bash when dealing with extensive history records.\n- **Duplicates**: Eliminates the clutter of repeated commands in your history to streamline the search process.\n\n## Installation\n\nInstall `history-watcher` by running the following command:\n\n```bash\ngo install github.com/minoritea/history-watcher@latest\n```\n\n## How to use\n\nTo use `history-watcher`, perform the following steps:\n\n### bash\n\n1. Install a fuzzy finder like `peco` or `fzf`.\n2. Launch `history-watcher` as a background service.\n   [goemon](https://github.com/minoritea/goemon) is a useful tool for managing background services.\n   ```bash\n   goemon -- history-watcher\n   ```\n3. Define a function in your `.bashrc` to interact with `history-watcher` using the chosen fuzzy finder:\n   ```bash\n   function hp() {\n     local action\n     action=$(curl -N -s localhost:14444 | peco)\n     READLINE_LINE=\"${action}\"\n     READLINE_POINT=\"${#READLINE_LINE}\"\n   }\n   bind -x '\"\\C-r\": hp'\n   bind '\"\\C-xr\": hp'\n   ```\n4. Retrieve your history using the regular bash history shortcut keys.\n\n#### NOTE\n\nIf you want to specify a custom history format, split the format into two lines:\none for the execution command and one for the metadata.\nPrefix the metadata line with `#`, such as for timestamps.\n\n### zsh\n\n1. Install a fuzzy finder like `peco` or `fzf`.\n2. Launch `history-watcher` as a background service.\n   [goemon](https://github.com/minoritea/goemon) is a useful tool for managing background services.\n   ```zsh\n   goemon -- env HW_HISTFILE_FORMAT=zsh_extended history-watcher\n   ```\n3. Define a function in your `.zshrc` to interact with `history-watcher` using the chosen fuzzy finder:\n   ```zsh\n   function __search_history() {\n     BUFFER=`curl -N -s localhost:14444 | peco`\n     CURSOR=$#BUFFER\n     zle reset-prompt\n   }\n   zle -N __search_history\n   bindkey '^R' __search_history\n   ```\n4. Retrieve your history using the regular zsh history shortcut keys.\n\n## Implementation\n\nhistory-watcher monitors the .bash_history file, captures command history, and stores it in an ordered set sorted by the last execution time. Therefore, it retains command history without duplication as long as it is the same command invocation. It also provides an HTTP endpoint, so when accessed from an HTTP client, it returns the stored command history. history-watcher includes all command history in the HTTP response, but it returns them in ascending order as a stream. This allows you to start narrowing down and selecting results without waiting for the retrieval of all results by combining it with a fuzzy finder that supports stream input.\n\n## Options\n\nYou can change the behavior of the tool by defining the following environment variables:\n\n- **HW_HOST**: The address on which the server binds(default: 127.0.0.1)\n- **HW_PORT**: The port number on which the server binds(default: 14444)\n- **HW_TOKEN**: Required for authentication token for retrieving command history(default: NONE)\n- **HW_DB_FILE**: Persists command history to a file or database(default: ~/.cache/history-watcher.db)\n  - to disable persistence, set HW_DB_FILE to `-`\n- **HW_HISTFILE**: Shell's history file(default: ~/.bash_history, when zsh or zsh_extended is specified as HW_HISTFILE_FORMAT, ~/.zsh_history)\n- **HW_HISTFILE_FORMAT**: Shell's history file format(default: bash)\n  - **bash**: Default format.\n  - **zsh**: Zsh's history file format.\n  - **zsh_extended**: Extended Zsh's history file format.\n- **HW_POLL**: Polls the .bash_history file for monitoring(default: false)\n\n## License\n\n`history-watcher` is licensed under the GNU General Public License v3.0.\nFeel free to contribute to the project, report issues, or suggest improvements on GitHub.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fminoritea%2Fhistory-watcher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fminoritea%2Fhistory-watcher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fminoritea%2Fhistory-watcher/lists"}