Discover, install, and configure shell plugins with Fig Plugin Store →
🔥

Percol Plugin

Allows interactively incrementally search history/checkout git branches and other stuff

robturtle
|
8 stars
0

percol

Maintainer: @robturtle

It provides two functionalities that allows you search history and resume background jobs with interactively incremental searching utility powered by percol.

Usage

  1. Use Ctrl-R to search the history.

    interactively search history

  2. User Ctrl-H to search aliases

  3. Use Ctrl-T to switch to another git branch

  4. Use Ctrl-Q to resume background jobs.

    interactively resume background jobs

Installation

  1. Install percol by running the following:
   pip install percol
  1. Clone the repository into your custom folder. Assuming your custom folder is at ~/.oh-my-zsh/custom
  mkdir -p ~/.oh-my-zsh/custom/plugins
  git clone https://github.com/robturtle/percol.plugin.zsh.git ~/.oh-my-zsh/custom/plugins/percol
  1. Enable the plugin by adding it to your plugins definition in ~/.zshrc.
  plugins=(percol)
  1. Enable Emacs-like keyboard shortcuts
  mkdir -p ~/.percol.d
  touch ~/.percol.d/rc.py

And copy-paste the contents into ~/.percol.d/rc.py.

  # file: ~/.percol.d/rc.py
  # Emacs like
  percol.import_keymap({
      "C-h" : lambda percol: percol.command.delete_backward_char(),
      "C-d" : lambda percol: percol.command.delete_forward_char(),
      "C-k" : lambda percol: percol.command.kill_end_of_line(),
      "C-y" : lambda percol: percol.command.yank(),
      "C-t" : lambda percol: percol.command.transpose_chars(),
      "C-a" : lambda percol: percol.command.beginning_of_line(),
      "C-e" : lambda percol: percol.command.end_of_line(),
      "C-b" : lambda percol: percol.command.backward_char(),
      "C-f" : lambda percol: percol.command.forward_char(),
      "M-f" : lambda percol: percol.command.forward_word(),
      "M-b" : lambda percol: percol.command.backward_word(),
      "M-d" : lambda percol: percol.command.delete_forward_word(),
      "M-h" : lambda percol: percol.command.delete_backward_word(),
      "C-n" : lambda percol: percol.command.select_next(),
      "C-p" : lambda percol: percol.command.select_previous(),
      "C-v" : lambda percol: percol.command.select_next_page(),
      "M-v" : lambda percol: percol.command.select_previous_page(),
      "M-<" : lambda percol: percol.command.select_top(),
      "M->" : lambda percol: percol.command.select_bottom(),
      "C-m" : lambda percol: percol.finish(),
      "C-j" : lambda percol: percol.finish(),
      "C-g" : lambda percol: percol.cancel(),
  })

Upgrade

cd ~/.oh-my-zsh/custom/plugins/percol && git pull && cd -