Coder Social home page Coder Social logo

Comments (8)

LangLangBart avatar LangLangBart commented on July 17, 2024 1

for example, cd <TAB> doesn't invoke fzf

Try

cd ** <TAB>

or modify FZF_COMPLETION_TRIGGER1

export FZF_COMPLETION_TRIGGER="" 
cd <TAB>

fzf/shell/completion.zsh

Lines 322 to 326 in c4a9ccd

# Explicitly allow for empty trigger.
trigger=${FZF_COMPLETION_TRIGGER-'**'}
[ -z "$trigger" -a ${LBUFFER[-1]} = ' ' ] && tokens+=("")

Footnotes

  1. junegunn/fzf - README -Settings

from fzf.

LangLangBart avatar LangLangBart commented on July 17, 2024 1

The completion widget from zsh4humans goes much further with its functionality, allowing for the things you desire, like completion of env variables and CLI arguments.


The fzf completion widget is kept minimal for a reason.

Related comment by the maintainer:

There is some customization one can easily do for additional commands, for example doge1.

But completion of environment variables or CLI arguments seems to require more changes to the actual *zsh file. Usually, one has to write it themselves or use popular plugins.

Footnotes

  1. junegunn/fzf - README - Custom fuzzy completion

from fzf.

pjhfggij avatar pjhfggij commented on July 17, 2024

Thank you @LangLangBart that works. I came across this video in the meantime that mentions FZF_COMPLETION_TRIGGER as well, but I would struggle to find out whether setting it to an empty string is a supported use case. I couldn't find it set explicitly in my current zsh framework (z4h), so thank you.

Can I ask you by the way if you know how to set it to also fuzzy search completion of command line arguments? It doesn't seem to work right now when I try to get information on ls flags for example:
ls -<TAB>

but it also didn't work when I tried:
ls -**<TAB>
so is it not supported out of the box by fzf's completion.zsh script?

from fzf.

pjhfggij avatar pjhfggij commented on July 17, 2024

also is there a list of completions that fzf-completion supports? kill is supported for example (kill <TAB>), but variables don't seem to work (echo $FZF_<TAB> )

from fzf.

LangLangBart avatar LangLangBart commented on July 17, 2024

zsh framework (z4h),

I use zsh4humans as well, what is the output of the following command ?

bindkey | grep -F '^I'

try

z4h bindkey z4h-fzf-complete Tab 

from fzf.

pjhfggij avatar pjhfggij commented on July 17, 2024

sorry, I've used z4h on the previous machine, but I'm trying to write .zshrc from scratch now (hence confusion)

on z4h Tab triggers fzf completion out of the box, but when sourcing fzf zsh scripts without any framework, while export FZF_COMPLETION_TRIGGER="" does work for path completions (e.g. cd <TAB>) it still doesn't seem to complete in some contexts that worked in z4h (e.g. echo $FZF_<TAB> or ls -<TAB> mentioned above)

from fzf.

pjhfggij avatar pjhfggij commented on July 17, 2024

Perfect, thank you. That explains a lot. The lines between the z4h framework and fzf weren't clear to me until now.

I will see if it will be worth installing something like fzf-tab to compensate for missing completions.

I've also noticed that export FZF_COMPLETION_TRIGGER="" now breaks some zsh completions - instead of listing the usual completions on ls -<TAB> for example fzf kicks in showing file names (instead of flags and their explanations).

One might argue though that ls --help | fzf would yield the same or even better result. So I might just stay with vanilla fzf's completion.zsh in the end

from fzf.

pjhfggij avatar pjhfggij commented on July 17, 2024

I've decided to give fzf-tab a try - the author seems to have thought the problem through well and the first attempts at running it showed a lot of desirable properties (straightforward frontend to the zsh's default compsys; simple zsh codebase). Maybe it will turn out not to be as "robust" as completion integration in zsh4humans, but fingers crossed it will work for my use cases.

from fzf.

Related Issues (20)

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.