• Stars
    star
    121
  • Rank 286,998 (Top 6 %)
  • Language
    Shell
  • License
    Creative Commons ...
  • Created about 8 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Search shell history with peco when pressing ctrl+r.

zsh-peco-history

Search shell history with peco when pressing ctrl+r.

Based on zsh-history-search snippet from percol.

screenshot

Usage

  1. Press ctrl+r while in a zsh shell and it should load up peco with your shell's history.
  2. Start typing to filter history down.
  3. Press enter/return to pick a command from history.

Requirements

  • peco
  • zsh
  • tac, or tail with support for -r option.
  • perl, awk, or uniq if de-duplication is turned on.

Installation

Manual

  1. Clone this repo to your machine. This guide uses ~/.zsh/zsh-peco-history:

    git clone https://github.com/jimeh/zsh-peco-history.git ~/.zsh/zsh-peco-history
  2. Add the following to the end of your .zshrc:

    source ~/.zsh/zsh-peco-history/zsh-peco-history.zsh
  3. Start a new terminal session.

Zplug

  1. Add a zplug definition for zsh-peco-history to your .zshrc:

    zplug "jimeh/zsh-peco-history", defer:2
  2. Start a new terminal session.

Antigen

  1. Add a antigen bundle definition for zsh-peco-history to the end of the antigen setup in your .zshrc:

    antigen bundle jimeh/zsh-peco-history
  2. Start a new terminal session.

Oh My Zsh

  1. Clone this repository into $ZSH_CUSTOM/plugins (by default ~/.oh-my-zsh/custom/plugins)

    git clone https://github.com/jimeh/zsh-peco-history.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-peco-history
  2. Add the plugin to the list of plugins for Oh My Zsh to load:

    plugins=(zsh-peco-history)
  3. Start a new terminal session.

Configuration Options

ZSH_PECO_HISTORY_OPTS

Command-line arguments passed to peco. Defaults to --layout=bottom-up if the variable is not set.

A lot of the Peco options available on the command-line, are also available via Peco's config file. It's up to you how you want to manage your Peco settings.

For example, if you want to use the bottom-up layout, and change to fuzzy filtering:

ZSH_PECO_HISTORY_OPTS="--layout=bottom-up --initial-filter=Fuzzy"

ZSH_PECO_HISTORY_DEDUP

De-duplicates all history entries before they are handed over to peco. Disabled by default.

To enable, set the ZSH_PECO_HISTORY_DEDUP environment variable to a non-zero value before zsh-peco-history is loaded.

This is useful if you often have a lot of duplicate entries when searching through your history. However in that case it often enough to configure ZSH to not save duplicate commands to history in the first place. This can be done by setting the following options:

setopt HIST_EXPIRE_DUPS_FIRST
setopt HIST_IGNORE_DUPS
setopt HIST_IGNORE_ALL_DUPS
setopt HIST_FIND_NO_DUPS
setopt HIST_SAVE_NO_DUPS

Oh My Zsh for example sets the above options, and more in it's history.zsh file.

Recommended Peco Config

You don't have to use this config, it's simply what I personally use. So here's what my ~/.peco/config.json file looks like:

{
  "Keymap": {
    "M-v": "peco.ScrollPageUp",
    "C-v": "peco.ScrollPageDown",
    "C-g": "peco.Cancel",
    "M-Space": "peco.ToggleRangeMode",
    "M-c": "peco.CancelRangeMode"
  },
  "Style": {
    "Basic": ["on_default", "default"],
    "Matched": ["cyan"],
    "Query": ["default"],
    "SavedSelection": ["on_blue", "white"],
    "Selected": ["on_magenta", "default"]
  }
}

License

CC0 1.0 Universal

More Repositories

1

git-aware-prompt

Display current Git branch name in your terminal prompt when in a Git working directory.
Shell
2,139
star
2

tmux-themepack

A pack of various Tmux themes.
Go
1,564
star
3

tmuxifier

Tmuxify your Tmux. Powerful session, window & pane management for Tmux.
Shell
1,018
star
4

build-emacs-for-macos

Somewhat hacky script to automate building of Emac.app on macOS.
Go
434
star
5

emacs-builds

Self-contained Emacs.app builds for macOS, with native-compilation support.
Go
303
star
6

manservant

Browse man pages in style with your personal manservant.
Perl
164
star
7

redistat

A Redis-backed statistics storage and querying library written in Ruby.
Ruby
155
star
8

docker-znc

Run the ZNC IRC Bouncer in a Docker container.
Shell
134
star
9

PastryKit

A little-known and unreleased iPhone web-app Javascript framework developed by Apple.
JavaScript
104
star
10

.emacs.d

My personal Emacs config with any quirks, oddities, bugs, and man-eating errors I live with on a daily basis.
Emacs Lisp
98
star
11

twilight-bright-theme.el

A Emacs port of the TextMate theme by the same name with some minor tweaks and additions.
Emacs Lisp
63
star
12

stub.sh

Helpers for bash script testing to stub/fake binaries and functions. Includes support for validating number of stub calls, and/or if stub has been called with specific arguments.
Shell
53
star
13

php-rack

An implementation of the middleware execution stack from Ruby's Rack library, for PHP.
PHP
52
star
14

dotfiles

My personals dotfiles with any quirks, oddities, bugs, and man-eating errors I live with on a daily basis.
Shell
40
star
15

twilight-anti-bright-theme

A light-on-dark Emacs and TextMate theme inspired by the dark-on-light Twilight Bright TextMate theme.
Emacs Lisp
40
star
16

common-flow

An attempt to gather a sensible selection of the most common usage patterns of git into a single and concise specification.
40
star
17

birds-of-paradise-plus-theme.el

A Emacs port of Joseph Bergantine's light-on-dark theme by the same name.
Emacs Lisp
38
star
18

node-base58

Base58 encoding and decoding for Node.js
JavaScript
33
star
19

rubocopfmt.el

Emacs minor-mode to format Ruby code with RuboCop on save.
Emacs Lisp
16
star
20

go-midjourney

Go
15
star
21

760-grid-system

Use the same principals of the 960 grid system within Facebook's 760 pixel wide frame for Facebook Applications.
Ruby
15
star
22

jimeh.me-v3.0

Jekyll project of a old version my personal website and blog.
CSS
13
star
23

tomorrow-night-paradise-theme.el

A light-on-dark Emacs theme which is essentially a tweaked version of Chris Kempson's Tomorrow Night Bright theme.
Emacs Lisp
11
star
24

litemysql

Very light-weight and simple ORM-like MySQL library for PHP. Kind of like ActiveRecord's little brother.
PHP
11
star
25

amqp-failover

Add multi-server support with failover and fallback to the amqp gem.
Ruby
10
star
26

homebrew-emacs-builds

Ruby
9
star
27

jimeh.github.io

This is the source-code for my personal website.
SCSS
9
star
28

suggest_results

Easily customizable search suggestion plugin for jQuery, which suggests results directly, rather than search terms.
JavaScript
7
star
29

collecta_ruby

A light Ruby library / Rails plugin for querying the Collecta API.
Ruby
7
star
30

ansible-adguardhome

Ansible role to install and run AdGuard Home, with support for non-root operation.
Python
7
star
31

mta-sts-on-github-pages

Template repository for hosting MTA-STS (.well-known/mta-sts.txt) on GitHub Pages.
6
star
32

go-golden

Yet another Go package for working with *.golden test files, with a focus on simplicity.
Go
6
star
33

yank-indent

Emacs minor-mode that ensures pasted (yanked) text has the correct indentation level.
Emacs Lisp
6
star
34

airbrake-statsd

Extends the Airbrake gem to also report exceptions to Esty's StatsD statistics aggregator.
Ruby
6
star
35

greek_easter

Never wonder again when easter is in Greece.
Ruby
6
star
36

facebooker_plus

A Ruby on Rails plugin fixing, extending and adding features to Facebooker, possibly beyond the originally intended scope of Facebooker itself.
Ruby
5
star
37

fancy_input

Easily customizable search suggestion plugin for jQuery, which suggests results directly, rather than search terms. (Formally known as suggest_results)
JavaScript
5
star
38

casecmp

Case-insensitive string comparison, as an API. Because Β―\_(ツ)_/Β―
Go
5
star
39

docker-flexget

Simple Docker container for running Flexget
Shell
4
star
40

zynapse

Rails-like MVC framework for PHP5. Currently abandoned and published for educational reasons.
JavaScript
4
star
41

twhois

Whois-like command-line tool and Ruby Gem for Twitter users
Ruby
3
star
42

undent

Go package which removes leading indentation/white-space from strings.
Go
3
star
43

Dockerfiles

Small collection of Docker and Docker Compose files I use to run stuff on my personal laptop
Shell
3
star
44

standardfmt.el

Emacs minor-mode to format JavaScript with standard / semistandard on save.
Emacs Lisp
3
star
45

time_ext

Extends the abilities of Ruby's built-in Time class by building on top of ActiveSupport.
Ruby
3
star
46

960-grid-system-plus

A clone/enhancement of the excellent 960 Grid System by Nathan Smith to fit my personal likes and dislikes.
3
star
47

tab-bar-notch

Adjust tab-bar height for MacBook Pro notch
Emacs Lisp
3
star
48

skyline

Ruby-based interactive shell tools to send terminal commands to instances in Amazon EC2 AutoScaling groups
Ruby
2
star
49

fastmail-rules

Go
2
star
50

kotaku-uk-rss

Small experimental web-scraper to provide a RSS feed of kotaku.co.uk for my own personal use.
Go
2
star
51

skyhook

A customized set of scripts and config files to deploy projects and control services on Amazon EC2.
Ruby
2
star
52

rubocopfmt

DEPRECATED! Easy formatting of Ruby code using rubocop. Analogous to gofmt.
Ruby
2
star
53

envctl

Go package providing test helper functions to temporarily change and restore environment variables.
Go
1
star
54

git-basics

A basic intro to git
1
star
55

tmux-themepack-previews

This holds nothing interesting. Go check out the Tmux Themepack project instead.
Shell
1
star
56

cloudflare-dyndns

Go
1
star
57

rands

Go package providing a suite of functions that use crypto/rand to generate cryptographically secure random strings in various formats.
Go
1
star
58

chef-btsync

A simple and quickly hacked together chef cookbook for installing and configuring BTSync on Ubuntu for my own personal needs.
Ruby
1
star
59

blank_gem

A blank/empty Ruby gem that does nothing.
Ruby
1
star
60

modern_bubbling

An Adium message style.
JavaScript
1
star
61

seedsafe

An attempt to learn about AES encryption.
Go
1
star
62

mje

Go
1
star
63

heartb.it

Ruby
1
star
64

pylight

Quick hack to create an HTTP API for accessing Pygments, and to start teaching myself Python.
Python
1
star
65

bah.io

Static landing page for bah.io
HTML
1
star
66

jimeh.me-api

Experimental project to rewrite my site and blog to run off of an EventMachine-based API. Cause it's fun ^_^
Ruby
1
star
67

play-store-notifier

Small shitty script I originally used to notify myself via email of when the Nexus 4 came back in stock. Now using it to find out when the Nexus 5 becomes available on the Play Store.
Ruby
1
star
68

rbheap

A tool to help with tracking down memory leaks in Ruby.
Go
1
star
69

ps4-20th-tool

A small tool built for educational purposes that attempts to pick apart Sony's 20 Years Of Character's website to find the secret URL.
Go
1
star
70

terraform-cloudflare-email

Terraform module to configure various email related DNS records on Cloudflare.
HCL
1
star