Git Product home page Git Product logo

fzf-tab-completion's Introduction

fzf-tab-completion

Tab completion using fzf in zsh, bash, GNU readline apps (e.g. python, php -a etc.)

This is distinct from fzf's own implementation for completion, in that it works with the existing completion mechanisms rather than creating a new mechanism.

Example

Installation

  1. You need to install fzf first.
  2. Clone this repository: git clone https://github.com/lincheney/fzf-tab-completon ...
    • you can also choose to download only the scripts you need, up to you.
  3. Follow instructions on how to set up for:
  4. The following environment variables are supported, just as in fzf's "vanilla" completion.

zsh

Add to your ~/.zshrc:

source /path/to/fzf-tab-completion/zsh/fzf-zsh-completion.sh
bindkey '^I' fzf_completion

If you have also enabled fzf's zsh completion, then the bindkey line is optional.

Note that this does not provide **-style triggers, you will need to enable fzf's zsh completion as well.

Searching display strings

By default, display strings are shown but cannot be searched in fzf. This is configurable via zstyle:

# only for git
zstyle ':completion:*:*:git' fzf-search-display true
# or for everything
zstyle ':completion:*' fzf-search-display true

bash

Add to your ~/.bashrc:

source /path/to/fzf-tab-completion/bash/fzf-bash-completion.sh
bind -x '"\t": fzf_bash_completion'

If you are using a bash that is dynamically linked against readline (LD_PRELOAD= ldd $(which bash)) you may prefer (or not!) to use the readline method instead.

readline

NOTE: This uses a LD_PRELOAD hack, is only supported on Linux and only for GNU readline (not e.g. libedit or other readline alternatives).

  1. Install https://github.com/lincheney/rl_custom_function/
    • consider adding export LD_PRELOAD=/path/to/librl_custom_function.so to your ~/.zshrc or ~/.bashrc
  2. Run: cd /path/to/fzf-tab-completion/readline/ && cargo build --release
  3. Copy/symlink /path/to/fzf-tab-completion/readline/bin/rl_custom_complete into your $PATH
  4. Add to your ~/.inputrc:
$include function rl_custom_complete /path/to/fzf-tab-completion/readline/target/release/librl_custom_complete.so
"\t": rl_custom_complete

These are the applications that I have seen working:

  • python2, python3
  • php -a
  • R
  • lftp
  • irb --legacy (the new irb in ruby 2.7 uses ruby-reline instead of readline)
  • gdb
  • sqlite3

Related projects

fzf-tab-completion's People

Contributors

lincheney avatar

Watchers

 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.