Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vindolin/selecta
Interactively select an entry from your bash history.
https://github.com/vindolin/selecta
Last synced: about 2 months ago
JSON representation
Interactively select an entry from your bash history.
- Host: GitHub
- URL: https://github.com/vindolin/selecta
- Owner: vindolin
- License: mit
- Created: 2016-01-05T07:46:58.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2024-02-15T20:31:59.000Z (11 months ago)
- Last Synced: 2024-09-17T03:30:16.439Z (4 months ago)
- Language: Python
- Homepage:
- Size: 14.3 MB
- Stars: 14
- Watchers: 5
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
Awesome Lists containing this project
README
selecta - Interactively search and select entries from your bash/zsh history.
-----------------------------------------------------------------------------[![Python package](https://github.com/vindolin/selecta/actions/workflows/python-package.yml/badge.svg?branch=master)](https://github.com/vindolin/selecta/actions/workflows/python-package.yml)
This is a Python3 clone of François Fleuret's excellent [selector](https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?p=selector.git;a=summary) tool.
[![Screencast](https://raw.githubusercontent.com/vindolin/selecta/master/screencast.gif)](https://raw.githubusercontent.com/vindolin/selecta/master/screencast.gif)
Usage
=====
Just type some characters and see which entries match your words.You can search for whole sentences by prefixing your search with a double quote.
Use up and down arrows to navigate the list.
Escape/Backspace on the result list returns to the search input.
Escape on the search input closes selecta.
Press Enter to copy the selected entry to the console.
CTRL+a toggles case sensitivity
CTRL+r toggles regex search
Installation
============```console
pip install selecta
```
Install the keyboard shortcut ALT+{key}:```console
selecta_add_keybinding {the alt key you want to use}
```This will append one of the following lines to your ~/.bashrc/zshrc:
```console
bind -x '"\C-[{key}":"\selecta -b -y <(history)"'
bindkey -s "^[{key}" "selecta -z -y <(history)^M"
```Upgrade from older version to 0.2.x
-----------------------------------
Delete your old keybinding from .bashrc/.zshrc and register the new version with:
```console
selecta_add_keybinding
```--help output
-------------```
usage: selecta [-h] [-i] [-b] [-z] [-e] [-a] [-d] [-y] [--bash] [--zsh]
[infile]positional arguments:
infile the file which lines you want to select eg. <(history)optional arguments:
-h, --help show this help message and exit
-i, --reverse-order reverse the order of the lines
-b, --remove-bash-prefix
remove the numeric prefix from bash history
-z, --remove-zsh-prefix
remove the time prefix from zsh history
-e, --regexp start in regexp mode
-a, --case-sensitive start in case-sensitive mode
-d, --remove-duplicates
remove duplicated lines
-y, --show-matches highlight the part of each line which matches the
substrings or regexp
--bash standard for bash history search, same as -b -i -d
--zsh standard for zsh history search, same as -b -i -d
```