Giter VIP home page Giter VIP logo

fuzzyfinders.sh's Introduction

The shell scripts fuzzyfinders.bash and fuzzyfinders.zsh set up key bindings in Bash and ZSH to insert, at the cursor position, a fuzzily found

  • command line of the history (by default bound to Ctrl-S),
  • file path (by default bound to Ctrl-T), listing first the recently (in the last $DAYS_LAST_MODIFIED) modified files,
  • the path of a subdirectory in the current directory (by default bound to Alt-C), listing first those recently changed to; uses either z.sh or z.lua, falls back to the in-built cdr in ZSH.

The file paths are listed among those inside the current working directory; in ZSH, optionally inside those after the path before the cursor position.

The fuzzy finder can be set by the variable $FUZZYFINDER and defaults, in this order, to the first fuzzy finder found among fzf, peco and fzy.

The functions _compgen_path (for files) and _compgen_dir (for directories) collect all paths and use by default the first file searcher among fd, ripgrep and ag, before falling back to the mandatorily present command find (on a UNIX system, according to the POSIX standard).

Installation

  1. Save these scripts, say to ~/.config/sh, and mark them executable by

    mkdir ~/Downloads
    cd ~/Downloads
    git clone https://github.com/Konfekt/fuzzyfinders.sh
    mkdir --parents ~/.config/sh
    cp ~/Downloads/fuzzyfinders.sh/fuzzyfinders.{bash,zsh} ~/.config/sh
    chmod a+x ~/.config/sh/fuzzyfinders.{bash,zsh}
  2. Source them on shell startup by adding to the shell configuration file

    • which is ~/.profile for Bash, the line
    . "$HOME/.config/sh/fuzzyfinders.bash"
    • respectively ~/.zshrc for ZSH, the line
    . "$HOME/.config/sh/fuzzyfinders.zsh"
  3. To use the Ctrl-S binding, add [ -n "${TTY:-}" ] && stty -ixon <"$TTY" >"$TTY" to your ~/.bashrc respectively unsetopt FLOW_CONTROL to your .zshrc.

Customization

The fuzzy finder can be set by the variable $FUZZYFINDER and defaults, in this order, to whichever fuzzy finder among sk, fzf, peco and fzy is present. The number of days for a file to be considered recently modified can by set by the variable $DAYS_LAST_MODIFIED

The key bindings can be set by the first argument of the command bind (in Bash) respectively bindkey (in ZSH).

Related

See vim-fuzzyfinders for the corresponding Vim plug-in.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.