Coder Social home page Coder Social logo

semtle / fz Goto Github PK

View Code? Open in Web Editor NEW

This project forked from changyuheng/fz.sh

0.0 0.0 0.0 4.57 MB

Cli shell plugin, the missing fuzzy tab completion feature of z

Home Page: http://changyuheng.me/2017/fz-fuzzy-search-in-tab-completions-of-z.html

License: MIT License

Shell 100.00%

fz's Introduction

fz

A shell plugin that seamlessly adds fuzzy search to tab completion of z, lets you easy to jump around among your historical directories. Not any additional key binding is needed. Currently supports Bash and zsh.

Demo

gif-demo

Installation

By simply sourcing corresponding script file for your shell, you're all set. However, this plugin is sitting on top of z and fzf, so you must have them installed as well.

N.B. fz needs to be sourced after z.

macOS

Bash

  1. Install fzf via Homebrew.

    brew install fzf
  2. Download z and fz.

    mkdir ~/.bash_completion.d
    curl "https://raw.githubusercontent.com/rupa/z/master/{z.sh}" \
        -o ~/.bash_completion.d/"#1"
    curl "https://raw.githubusercontent.com/changyuheng/fz/master/{fz.sh}" \
        -o ~/.bash_completion.d/z"#1"
  3. Add the following content to ~/.bashrc:

    if [ -d ~/.bash_completion.d ]; then
      for file in ~/.bash_completion.d/*; do
        . $file
      done
    fi

zsh

  1. Install fzf via Homebrew.

    brew install fzf
  2. Install z and fz via zplug. Add the following content to ~/.zshrc:

    zplug "changyuheng/fz", defer:1
    zplug "rupa/z", use:z.sh

Ubuntu

Bash

  1. Install fzf.

    git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
    ~/.fzf/install
  2. Download z and fz.

    mkdir ~/.bash_completion.d
    curl "https://raw.githubusercontent.com/rupa/z/master/{z.sh}" \
        -o ~/.bash_completion.d/"#1"
    curl "https://raw.githubusercontent.com/changyuheng/fz/master/{fz.sh}" \
        -o ~/.bash_completion.d/z"#1"
  3. Add the following content to ~/.bashrc:

    if [ -d ~/.bash_completion.d ]; then
      for file in ~/.bash_completion.d/*; do
        . $file
      done
    fi

zsh

  1. Install fzf.

    git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
    ~/.fzf/install
  2. Install z and fz via zplug. Add the following content to ~/.zshrc:

    zplug "changyuheng/fz", defer:1
    zplug "rupa/z", use:z.sh

Usage

z [dir name slug]<TAB>
zz [dir name slug]<TAB>
  • The function of fz is pretty much like what it is of z. zz limits the search base starting from current working directory. Check z’s doc for more information.
  • tab/shift-tab, ctrl-n/ctrl-p, ctrl-j/ctrl-k, for next and previous item. Enter for selection. Check fzf’s doc for the search syntaxes.
  • FZ_CMD=z specifies command name of fz. Default is z.
  • FZ_SUBDIR_CMD=zz specifies command name for subdirectory only z. Default is zz.
  • FZ_SUBDIR_TRAVERSAL=0 disables subdirectory completion. Default is enabled.
  • FZ_CASE_INSENSITIVE=0 disables case-insensitive subdirectory completion. Default is enabled.
  • FZ_ABBREVIATE_HOME=0 disables abbreviating ~. Default is enabled.

See Also

License

This software is licensed under a MIT License.

fz's People

Contributors

changyuheng avatar

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.