• Stars
    star
    3,003
  • Rank 15,048 (Top 0.3 %)
  • Language
    Shell
  • License
    MIT License
  • Created almost 5 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Replace zsh's default completion selection menu with fzf!

fzf-tab

CI GitHub license

Replace zsh's default completion selection menu with fzf!

asciicast

Table of Contents

Install

NOTE: fzf-tab needs to be loaded after compinit, but before plugins which will wrap widgets, such as zsh-autosuggestions or fast-syntax-highlighting!!

NOTE 2: fzf-tab ALSO needs fzf installed, otherwise it cannot work!

Manual

First, clone this repository.

git clone https://github.com/Aloxaf/fzf-tab ~/somewhere

Then add the following line to your ~/.zshrc.

source ~/somewhere/fzf-tab.plugin.zsh

Antigen

antigen bundle Aloxaf/fzf-tab

Zinit

zinit light Aloxaf/fzf-tab

Oh-My-Zsh

Clone this repository to your custom directory and then add fzf-tab to your plugin list.

git clone https://github.com/Aloxaf/fzf-tab ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/fzf-tab

Prezto

Clone this repository to your contrib directory and then add fzf-tab to your module list in .zpreztorc.

git clone https://github.com/Aloxaf/fzf-tab $ZPREZTODIR/contrib/fzf-tab

Usage

Just press Tab as usual~

Available keybindings:

  • Ctrl+Space: select multiple results, can be configured by fzf-bindings tag

  • F1/F2: switch between groups, can be configured by switch-group tag

  • /: trigger continuous completion (useful when completing a deep path), can be configured by continuous-trigger tag

Available commands:

  • disable-fzf-tab: disable fzf-tab and fallback to compsys

  • enable-fzf-tab: enable fzf-tab

  • toggle-fzf-tab: toggle the state of fzf-tab. This is also a zle widget.

Configure

A common configuration is:

# disable sort when completing `git checkout`
zstyle ':completion:*:git-checkout:*' sort false
# set descriptions format to enable group support
zstyle ':completion:*:descriptions' format '[%d]'
# set list-colors to enable filename colorizing
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
# preview directory's content with exa when completing cd
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'exa -1 --color=always $realpath'
# switch group using `,` and `.`
zstyle ':fzf-tab:*' switch-group ',' '.'

For more information, please see Wiki#Configuration.

Binary module

By default, fzf-tab uses zsh-ls-colors to parse and apply ZLS_COLORS if you have set the list-colors tag.

However, it is a pure zsh script and is slow if you have too many files to colorize. fzf-tab is shipped with a binary module to speed up this process. You can build it with build-fzf-tab-module, then it will be enabled automatically.

Difference from other plugins

fzf-tab doesn't do "complete", it just shows you the results of the default completion system.

So it works EVERYWHERE (variables, function names, directory stack, in-word completion, etc.). And most of your configuration for default completion system is still valid.

Compatibility with other plugins

Some plugins may also bind "^I" to their custom widget, like fzf/shell/completion.zsh or ohmyzsh/lib/completion.zsh.

By default, fzf-tab will call the widget previously bound to "^I" to get the completion list. So there is no problem in most cases, unless fzf-tab is initialized before a plugin which doesn't handle the previous binding properly.

So if you find your fzf-tab doesn't work properly, please make sure it is the last plugin to bind "^I" (If you don't know what I mean, just put it to the end of your plugin list).

Related projects

More Repositories

1

silicon

Create beautiful image of your source code.
Rust
3,024
star
2

MirageTankGo

幻影坦克(特指点开后不一样的图片)快速发车工具
Python
140
star
3

LeetCode-Rust

听说刷题建 repo 是立 flag 一般的行为?
Rust
85
star
4

dotfiles

my dotfiles
Shell
67
star
5

Rust-toys

一堆写着练手的小玩意儿, 考虑到Rust的龟速编译, 还是放在一起比较省事
Rust
18
star
6

aur-build

Build AUR packages with GitHub Actions
Shell
15
star
7

leetcode_prelude

Some useful macros and definition for exercising in leetcode
Rust
13
star
8

ppool

一个爬虫 IP 代理池
Rust
11
star
9

CAPIx

使CMD能够高速调用API
C++
11
star
10

p7zip

a custom 7z, which can use three keys instead of password to extract zip file.
C++
10
star
11

gencomp

Generate zsh completion functions from manpage or `--help`
Python
10
star
12

NT4_CMD

从OpenNT提取的NT4_CMD_x86源码及其编译环境
C
10
star
13

cdda-itembrowser

CDDA 物品浏览器
PHP
8
star
14

telegraph-rs

telegraph API binding in Rust
Rust
7
star
15

Use-PosixPipeline

The POSIX version of Use-RawPipeline
C#
7
star
16

10_0_0_55_login

BIT 10.0.0.55 的登入与登出的Python实现
Python
7
star
17

Crypko.Spider

(目前是)一次性的Crypko小爬虫
Python
5
star
18

zsh-sqlite

A zsh module for manipulating sqlite database
C
4
star
19

facenote_thirdparty_app

为掌阅系统安装第三方 app
Python
4
star
20

crc32fix

fix png's length or height according to its crc32 checksum
Rust
4
star
21

ren3

Do file renaming using regular expressions. 使用正则表达式重命名文件.
Rust
3
star
22

funcall

Rust
3
star
23

GCD-1

综合性批处理游戏开发第三方
C
3
star
24

Aloxaf.github.io

my blog
HTML
2
star
25

cdda-wiki-bot

Python
2
star
26

GCD

GCD的dll版
C
2
star
27

IMGSolve

基于Python的可扩展的图片隐写分析工具
Python
2
star