Skip to main content

selecta - Interactively search and select entries from your bash/zsh history.

Python package

This is a Python3 clone of François Fleuret's excellent selector tool.

Screencast

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

pip install selecta

Install the keyboard shortcut ALT+{key}:

selecta_add_keybinding {the alt key you want to use}

This will append one of the following lines to your ~/.bashrc/zshrc:

bind -x '"\C-[{key}":"\selecta --bash -y <(history)"'
bindkey -s "^[{key}" "selecta --zsh -y <(history)^M"

Upgrade from older version to 0.2.x

Delete your old keybinding from .bashrc/.zshrc and register the new version with:

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

Metadata

Release files for selecta 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for selecta 0.2.2
File Size Uploaded
selecta-0.2.2.tar.gz 11.5 kB Details

Release files / selecta-0.2.2.tar.gz

Download URL selecta-0.2.2.tar.gz
Size 11.5 kB
Tags Source
SHA-256 checksum
How to use checksums
0a3055f6556d4e651cca325a7bf5d9f188a1d01124a035195a59e2f0f67facf8
BLAKE2b-256 checksum
How to use checksums
d4406b81142daf09ac911fead4c2e2db948cb9ba0aa2f5cc9a09119fc64b70e4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.12

Release history Release notifications | RSS feed

This release

0.2.2 This release

1 release file

0.2.1

2 release files

0.2.0

2 release files

0.1.2

1 release file

0.1.1

1 release file

0.1.0

2 release files

0.0.31

2 release files

0.0.30

2 release files

0.0.24

1 release file

0.0.23

1 release file

0.0.22

1 release file

0.0.21

1 release file

0.0.20

1 release file

0.0.19

1 release file

0.0.18

1 release file

0.0.17

1 release file

0.0.16

1 release file

0.0.15

1 release file

0.0.14

1 release file

0.0.13

1 release file

0.0.12

1 release file

0.0.11

1 release file

0.0.10

1 release file

0.0.9

1 release file

0.0.8

1 release file

0.0.7

1 release file

0.0.6

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

2 release files

0.0.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page