Coder Social home page Coder Social logo

Comments (9)

junegunn avatar junegunn commented on August 15, 2024

I'm assuming you're a bash user, and you can set it up as explained in https://github.com/junegunn/fzf?tab=readme-ov-file#supported-commands

from fzf.

DavideCanton avatar DavideCanton commented on August 15, 2024

I know, what I suggested is to add it to the built-in command completions.

from fzf.

junegunn avatar junegunn commented on August 15, 2024

I see, but if we add more commands to the default list, the time it takes to load the script increases accordingly, and it affects the other users who don't really use pytest (which I'm one of them), so I'm reluctant to grow the default list beyond a set of universal tools.

from fzf.

DavideCanton avatar DavideCanton commented on August 15, 2024

I see, but then I don't understand why I'm having python and java already registered, since I don't use java either.

from fzf.

junegunn avatar junegunn commented on August 15, 2024

Yeah, it's already not ideal, so let's not make it worse.

from fzf.

junegunn avatar junegunn commented on August 15, 2024

Having said that, maybe we could provide path as the default completion.

https://stackoverflow.com/a/49069150/755334

from fzf.

junegunn avatar junegunn commented on August 15, 2024
complete -D -F _fzf_path_completion -o default -o bashdefault 2> /dev/null

Hmm, unfortunately, this will likely break bash-completion, which sets its dynamic completion loader as the default completion function.

https://github.com/scop/bash-completion/blob/2dab63379b90619f93873976944f4f9ad338dc0d/bash_completion#L3260-L3271

from fzf.

junegunn avatar junegunn commented on August 15, 2024
__fzf_default_completion() {
  __fzf_generic_path_completion _fzf_compgen_path "-m" "" "$@"
  if [[ $? -eq 124 ]]; then
    _fzf_setup_completion path "$1"
    return 124
  fi
}

complete -D -F __fzf_default_completion -o default -o bashdefault 2> /dev/null

This version works slightly better, that it handles dynamic completion loader.

# No completion is defined
complete | grep pytest

# Fuzzy completion works
pytest **<tab>

# Regular completion; triggers dynamic completion loader
pytest <tab>

# Completion function for pytest is loaded
complete | grep pytest
  # complete -F _comp_cmd_pytest py.test
  # complete -F _comp_cmd_pytest py.test-3
  # complete -F _comp_cmd_pytest py.test-2
  # complete -F _comp_cmd_pytest pytest-3
  # complete -F _comp_cmd_pytest pytest-2
  # complete -F _fzf_path_completion pytest

# Fuzzy completion still works
pytest **<tab>

# Regular completion also works
pytest <tab>

# However, fuzzy completion for pytest-2, pytest-3, etc stops working
pytest-2 **<tab>

from fzf.

junegunn avatar junegunn commented on August 15, 2024

See #3958

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.