fast small embed history backend
Project description
xontrib-history-looseene
A smart, lightning-fast, and feature-rich history backend for the xonsh shell.
Looseene transforms your shell history into a mini search engine. It replaces xonsh's standard history with a compressed, inverted-index backend, enabling instant and relevant search results, even across massive command logs.
🚀 Features
- Interactive Search (
Ctrl+R): A powerful full-screen UI to navigate, search, and manage your history. - Command Execution Counts: Automatically tracks how often you run each command, helping you find your most-used tools.
- Custom Comments: Annotate commands with comments for context (
F3in UI orhs-commentcommand). - Prefix Search & Highlighting: Find commands by typing parts of a word (e.g.,
distfindsdistribution), with matches highlighted in yellow. - Smart & Fast: Uses the BM25 ranking algorithm to find the most relevant commands, not just the most recent. Data is stored in compressed binary segments using
mmap,zlib, andstructfor instant access. - Pure Python: No C-extensions or heavy dependencies. It just works.
📦 Installation
Open xonsh and run:
xpip install xontrib-history-looseene
⚙️ Configuration
To activate the backend, add this line to your .xonshrc file (e.g., ~/.config/xonsh/rc.xsh):
xontrib load looseene
Restart your shell. You should see a message Looseene: History backend loaded....
⌨️ Usage
Interactive Search (Ctrl+R)
Press Ctrl+R to open the interactive search window. What you've already typed on the command line will be used as the initial search query.
- Type to search in real-time.
- Up/Down Arrows to navigate results.
- Enter to select a command and place it on your command line.
- F3 to add or edit a comment for the selected command.
- Ctrl+C / Esc to exit; the text you typed in the search bar will be preserved on your command line.
Adding Comments
You can annotate commands with comments for better context, either interactively or from the command line.
- Interactively (F3): Press
F3while in theCtrl+Rmenu to open a dialog and add a comment to the selected command. - Via CLI: Use the
hs-commentalias.
# Usage: hs-comment <partial_command_to_find> "<your comment>"
hs-comment "docker-compose up" "start project services"
CLI Search
You can also search directly from the command line without the UI:
# Full command
hsearch "docker run"
# Alias
hs "git commit"
Maintenance (Compaction)
Looseene stores history in small "segments" on disk for fast writing. Over time, these can accumulate. To merge all segments into a single, optimized file and finalize metadata (counts and comments):
history-compact
Recommendation: Run this command occasionally to keep performance high.
🛠 Technical Details
- Storage:
~/.local/share/xonsh/looseene_history - Index Structure: Inverted index with delta-encoded postings lists.
- Backend: Custom implementation inheriting from
xonsh.history.base.History.
🤝 Contributing
Contributions are welcome!
- Fork the repo.
- Install in editable mode:
xpip install -e . - Submit a Pull Request.
📄 License
MIT License.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file xontrib_history_looseene-1.1.1.tar.gz.
File metadata
- Download URL: xontrib_history_looseene-1.1.1.tar.gz
- Upload date:
- Size: 53.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e4a0cb4920457d59f5b9920cc53e2bf2827e9534d718e1e50ccbbbbbbd8f9528
|
|
| MD5 |
ae45f85a06a5a453e8b35972aca135b8
|
|
| BLAKE2b-256 |
012a66c28d340bad74cb99d1e955188c12236a0466bbdd9a56c02ed9e6ba0f87
|
File details
Details for the file xontrib_history_looseene-1.1.1-py3-none-any.whl.
File metadata
- Download URL: xontrib_history_looseene-1.1.1-py3-none-any.whl
- Upload date:
- Size: 11.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cfff1959455511d048ab7efc669df802719a8d51483eed5a53d50deca700f101
|
|
| MD5 |
60c3b436be54715f21d068898e4c9660
|
|
| BLAKE2b-256 |
6efc037a0fa77e31cf378ca60f1e4cfe11dfe83868a28ff46a3edbae31fea10a
|