https://github.com/trygveaa/kitty-kitten-search
Kitten for searching in kitty
https://github.com/trygveaa/kitty-kitten-search
Last synced: about 1 year ago
JSON representation
Kitten for searching in kitty
- Host: GitHub
- URL: https://github.com/trygveaa/kitty-kitten-search
- Owner: trygveaa
- License: gpl-3.0
- Created: 2020-02-23T10:34:37.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-02-02T19:42:11.000Z (over 3 years ago)
- Last Synced: 2025-03-14T19:51:09.243Z (about 1 year ago)
- Language: Python
- Homepage:
- Size: 31.3 KB
- Stars: 239
- Watchers: 2
- Forks: 7
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Search kitten for kitty
[Kitten](https://sw.kovidgoyal.net/kitty/#kittens) for the [kitty terminal emulator](https://sw.kovidgoyal.net/kitty/) providing live incremental search in the terminal history.

## Installation
Place the two `.py` files in this repo (`search.py` and `scroll_mark.py`) in the same directory as `kitty.conf`.
Map a key to launch the kitten. E.g. for `kitty_mod+/` add this to `kitty.conf`:
```
map kitty_mod+/ launch --location=hsplit --allow-remote-control kitty +kitten search.py @active-kitty-window-id
```
### Alternatively:
Go to the directory where `kitty.conf` lies, run
```
git clone https://github.com/trygveaa/kitty-kitten-search kitty_search
```
The alternate directory name is needed to keep python happy. You then have to use as slightly other shortcut:
```
map kitty_mod+/ launch --allow-remote-control kitty +kitten kitty_search/search.py @active-kitty-window-id
```
If you are managing your dotfiles as a git directory, you can also add kitty-search as a submodule instead of cloning:
```
git submodule add https://github.com/trygveaa/kitty-kitten-search kitty_search
```
Now you only have to commit `.gitmodules` in your git directory and you are golden.
## Usage
Pressing the key you mapped will open a window where you can type your search. The search is performed immediately as you type each key, however currently it does not scroll to a match automatically if it is outside of the current content shown.
These keys can be used to control the kitten:
- Up/down arrow: Scroll to previous/next match
- Tab: Switch between literal match and regex match
- Ctrl-u: Clear the query
- Ctrl-a/e: Go to the beginning/end of the query
- Ctrl-Left/Right: Jump over words by space
- Ctrl-Backspace: Delete last word by space
- Alt-Left/Right: Jump over words by non-alphanumeric characters
- Alt-Backspace: Delete last word by non-alphanumeric characters
- Enter: Exit the kitten and keep the current scroll position
- Esc: Exit the kitten and scroll to the bottom of the history