Git Product home page Git Product logo

clink-fzf's Introduction

FZF integration for Clink

This script integrates the FZF "fuzzy finder" with the Clink command line editing enhancements for CMD.exe on Windows.

How to install

  1. Copy the fzf.lua file into your Clink scripts directory.

  2. Either put fzf.exe in a directory listed in the system PATH environment variable, or run clink set fzf.exe_location <put_dir_name_here> to tell Clink where to find the FZF program.

How to use

For detailed information on using FZF, please refer to the FZF documentation.

Here are the default key bindings in Clink:

Key Description
Ctrl+T Lists files recursively; choose one or multiple to insert them.
Ctrl+R Lists history entries; choose one to insert it.
Alt+C Lists subdirectories; choose one to 'cd /d' to it.
Alt+B Lists key bindings; choose one to invoke it.
Tab Uses fzf to filter match completions.
Ctrl+Space Uses fzf to filter match completions.

Note: For the default key bindings to work, you must be using Clink v1.2.46 or higher. If you're using an older version of Clink then consider upgrading Clink, or manually add key bindings in your .inputrc file as described below.

Recursive completion

You can use **Tab to list files recursively under the directory.

For example:

  • notepad ** lists files recursively under the current directory.
  • notepad foo** lists files recursively under the current directory, and uses foo as the search phrase.
  • notepad bar\foo** lists files recursively under the bar directory, and uses foo as the search phrase.

Overriding the default behaviors

Key bindings

You can use your own custom key bindings if you prefer.

Run clink set fzf.default_bindings false and add key bindings to your .inputrc file manually.

Run clink echo to find key bindings strings. See Key Bindings in the Clink documentation for more information on how to set key bindings.

The default key bindings for FZF are listed here in .inputrc file format for convenience:

# Default key bindings for fzf with Clink.
"\C-t":        "luafunc:fzf_file"       # Ctrl+T lists files recursively; choose one or multiple to insert them.
"\C-r":        "luafunc:fzf_history"    # Ctrl+R lists history entries; choose one to insert it.
"\M-c":        "luafunc:fzf_directory"  # Alt+C lists subdirectories; choose one to 'cd /d' to it.
"\M-b":        "luafunc:fzf_bindings"   # Alt+B lists key bindings; choose one to invoke it.
"\t":          "luafunc:fzf_complete"   # Tab uses fzf to filter match completions.
"\e[27;5;32~": "luafunc:fzf_complete"   # Ctrl+Space uses fzf to filter match completions.

There is also a "luafunc:fzf_selectcomplete" function which invokes clink-select-complete instead of complete. This enables the ** recursive completion behavior with the interactive completion command.

FZF options

You can specify FZF options for each of the different commands:

Env Var Name Description
FZF_CTRL_T_OPTS Options for Ctrl+T (the "luafunc:fzf_file" function).
FZF_CTRL_R_OPTS Options for Ctrl+R (the "luafunc:fzf_history" function).
FZF_ALT_C_OPTS Options for Alt+C (the "luafunc:fzf_directory" function).
FZF_BINDINGS_OPTS Options for Alt+B (the "luafunc:fzf_bindings" function).
FZF_COMPLETE_OPTS Options for Ctrl+Space (the "luafunc:fzf_complete" function).

File and directory list commands

You can specify commands to run for collecting files or directories:

Env Var Name Description
FZF_CTRL_T_COMMAND Command to run for collecting files for Ctrl+T (the "luafunc:fzf_file" function).
FZF_ALT_C_COMMAND Command to run for collecting directories for Alt+C (the "luafunc:fzf_directory" function).

clink-fzf's People

Contributors

chrisant996 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.