Giter Club home page Giter Club logo

fzf-tab-source's Introduction

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

fzf-tab-source's People

Contributors

fabian-thomas avatar freed-wu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

fzf-tab-source's Issues

Only enable selected plugins

Hi! I only want to enable several plugins, not all of them.
Please, provide a way (similar to plugins=() in .zshrc) to do that :)

Bug of less

After I updated less, this plugin cannot work. I am finding reason. In another PC with less 608, it works normally.

[2023-05-17T23:22:43+0800] [ALPM] upgraded less (1:608-2 -> 1:633-1)

add install instructions

Hello,

I was trying to use this and the instructions don't actually say how to install this. A line saying to source the fzf-tab-source.plugin.zsh would be helpful. (Maybe this would be automatically done with plugin managers, but I don't use any..?).

Thanks!

I can't get it to work fully

Can you help me understand why it won't work?

Problem

I only get previews for certain files like text files. For most others, like directories I get:
image
image
Also for text files it uses cat, not bat

Info

I tried installing from the AUR and also pulling from the repo directly.
These are the relevant lines in my .zshrc. I tried disabling many of them without success.

_fzf_compgen_path() {
  fd --hidden --follow --exclude ".git" . "$1"
}
# Use fd to generate the list for directory completion
_fzf_compgen_dir() {
  fd --type d --hidden --follow --exclude ".git" . "$1"
}
[ -f /usr/share/fzf/completion.zsh ] && . /usr/share/fzf/completion.zsh
[ -f /usr/share/fzf/key-bindings.zsh ] && . /usr/share/fzf/key-bindings.zsh
[ -f ~/.fzf-tab-source/fzf-tab-source.plugin.zsh ] && . ~/.fzf-tab-source/fzf-tab-source.plugin.zsh
[ -f ~/.fzf-tab/fzf-tab.plugin.zsh ] && . ~/.fzf-tab/fzf-tab.plugin.zsh
zstyle ':fzf-tab:*' fzf-bindings 'ctrl-space:toggle+down'

This is a relevant line in my .zprofile

export FZF_DEFAULT_OPTS="--bind=tab:down,shift-tab:up,ctrl-space:toggle+down"

I also tried removing it and rebooting.

How to install and use...😦

Check the installation documentation...but I still don't understand...
.zshrc configfile I have these

zinit light Aloxaf/fzf-tab
zinit light Freed-Wu/fzf-tab-source
source /home/user/.local/zinit/plugins/Freed-Wu---fzf-tab-source/sources/*.zsh

Then I deleted some of my settings.
eg:
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'eza -1 --color=always $realpath'
But I didn't feel any change.

Preview gallery
Note: if you don't want to spend time to write these configs by yourself, you can try this zsh plugin.

what steps did I take wrong?
or, I understood it wrong, I still need to configure fzf-tab manually, right?

I'd appreciate a response. thanks🙏

get current width and height ?

Is it possible to get the current width and hight of the preview box ?

I am trying to make timg work with this but it requires the current width and height of the terminal.
tput and the env variables ($LINES etc) point to the actual terminal, while stty fails.

Do not spoil home directory

Thanks for the amazing plugin.

Please do not create empty directories by default.

Empty file within directory under $HOME/.gitmoji/ is created irrespective of whether program is installed or not.

May be you can just add a check to see if gitmoji is installed before creating the directory

homebrew completions cannot work

Right now, it seems like brew commands do not have a preview.
from the fzf-tab wiki, this does work:

zstyle ':fzf-tab:complete:brew-(install|uninstall|search|info):*-argument-rest' fzf-preview 'brew info $word'

maybe consider adding it ?

Bat not showing full text file

1-0105-Jan172024
Image shows bat output on bottom pane for the same file being previewed and truncated in the top pane.
I'm using your ~/.lessfilter and kitty. Here are some environmental variables and options I think may be relevant

LS_OPTIONS=-N --color=tty -T 0
LESS=-r -M -r -M --mouse -S -I
LESSOPEN=|/usr/bin/lesspipe.sh %s
LESSQUIET=1
PAGER=less
FZF_DEFAULT_OPTS=--cycle --layout=reverse --height=90% --preview-window=wrap --scroll-off=3 --bind tab:down,shift-tab:up

bat config =
--color='always'
--theme='Coldark-Dark'
--style=plain
--pager=less
--wrap=character

Running openSUSE Tumbleweed with lesspipe installed from source and using zcomet with these plugins

Plugins:
  3v1n0/zsh-bash-completions-fallback
  aubreypwd/zsh-plugin-require
  Freed-Wu/fzf-tab-source
  Freed-Wu/zsh-colorize-functions
  Freed-Wu/zsh-completions-for-cross-compilers
  Freed-Wu/zsh-help
  jdujava/fzf-tab-jd
  Licheam/zsh-ask
  mdumitru/last-working-dir
  microsoft/inshellisense
  zdharma-continuum/fast-syntax-highlighting
  zpm-zsh/colorize
  zpm-zsh/ssh
  zsh-users/zsh-autosuggestions
FPATH elements:
  corvofeng/joe-completion
  grigorii-zander/zsh-npm-scripts-autocomplete
  MenkeTechnologies/zsh-more-completions
  nix-community/nix-zsh-completions
  sainnhe/zsh-completions
  sambergo/zsh-prettier-completion
  syohex/zsh-misc-completions

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.