Skip to content

Freed-Wu/fzf-tab-source

Repository files navigation

fzf-tab-source

pre-commit.ci status

github/downloads github/downloads/latest github/issues github/issues-closed github/issues-pr github/issues-pr-closed github/discussions github/milestones github/forks github/stars github/watchers github/contributors github/commit-activity github/last-commit github/release-date

github/license github/languages github/languages/top github/directory-file-count github/code-size github/repo-size github/v

This zsh plugin is a collection of fzf-tab's sources. Please read the wiki first.

Install

This plugin respects zsh plugin standard, so if you use any plugin manager and follow the instructions of your plugin manager, it can be installed correctly.

If you don't use any plugin manager, just add the following code to ~/.zshrc:

source /the/directory/of/this/plugin/*.plugin.zsh

NOTE: Don't source *.zsh! They will be sourced by *.plugin.zsh automatically.

Preview

You need some optional tools:

less

This plugin uses less to display any file. less can be configured by the environment variable LESSOPEN.

$ echo $LESSOPEN
|/usr/bin/lesspipe %s

NOTE: in some GNU/Linux distributions, it's lesspipe.sh or other names.

lesspipe is a script to select different tool for different kind of file. You can write your ~/.lessfilter to customize lesspipe. For example:

lesspipe selects ls to display a directory. You can install some tools to view directories, such as:

  • eza: written in rust
  • lsd: written in rust
  • colorls: written in ruby

dir

You can install some tools to view code, such as:

text

lesspipe doesn't display image. You can install some tools to view images, such as:

image

My ~/.lessfilter can be a reference.

pinyin

pinyin-completion: complete pinyin in your zsh.

This plugin also uses less to view the completion results of pinyin-completion.

user-expand

zsh

-parameter-

This plugin uses any one of the following tools to display user information:

  • finger
  • pinky

-tilde-

This plugin also uses less to view commands. lesspipe uses ldd to view binary programs.

-command-

bindkey

zinit

zinit is a zsh plugin manager. Preview every zsh plugin's README.md.

zinit

hexyl

Other tools which can display binary files are supported, too:

  • od
  • xxd

hexyl

git

git

This plugin uses your git's pagers to view the outputs of some git command.

For example, by default:

$ git log --oneline
3ee9df0 :heavy_plus_sign: Add emojify
d74f60a :sparkles: Add sysctl, lsof, arp, netstat, ss, archlinux-java, coredumpctl
592d286 :pencil2: Fix a typo about command
4dd0c69 :children_crossing: Fix #8, don't mkdir ~/.gitmoji

You can install emojify then:

git config --global pager.log emojify
$ git log --oneline
3ee9df0 ➕ Add emojify
d74f60a ✨ Add sysctl, lsof, arp, netstat, ss, archlinux-java, coredumpctl
592d286 ✏️ Fix a typo about command
4dd0c69 🚸 Fix #8, don't mkdir ~/.gitmoji

git log

My ~/.config/git/config can be a reference.

kill

Preview which command will be killed after kill XXX.

kill

make

Preview which command will be executed after make XXX.

make

systemctl

systemctl

adb

We cannot ensure any program (eza, etc) are installed in other machine (Android). This plugin uses Android's ls to display directory and cat to display text.

adb

Customize

Sources

zstyle ':fzf-tab:sources' config-directory /a/directory

You can use your customized fzf-tab sources to override this plugin's sources. *.zsh in config-directory are standalone zsh scripts which can be syntax highlighted by your editor:

# :fzf-tab:complete:context --optional-fzf-option
foobar $word
  • Built-in commands and aliases should start with (\\|) to support \command
  • Commands should start with (\\|*/|) to support =command

That is, \command <TAB>, =command <TAB> will get same preview windows as command <TAB>.

Similar Project

About

⚙️ a collection of fzf-tab completion sources.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published