Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow placing a ' at the end of a search term for an exact match #1336

Open
3 of 7 tasks
dylan-chong opened this issue Jul 17, 2018 · 5 comments
Open
3 of 7 tasks

Allow placing a ' at the end of a search term for an exact match #1336

dylan-chong opened this issue Jul 17, 2018 · 5 comments

Comments

@dylan-chong
Copy link

  • Category
    • fzf binary
    • fzf-tmux script
    • Key bindings
    • Completion
    • Vim
    • Neovim
    • Etc.
  • OS - all
  • Shell - all

so that the search terms are equivalent: 'hello and hello'

It will be useful in a use case such as this :

  • I type in hello
  • there are too many search results, so I want to do an exact match. Therefore I simply type ' so the search term is hello'
  • there are still too many search results, so I type in another search term so that the search is hello' world

currently, the use that will have to type a few more keystrokes, which is a little less intuitive

  • I type in hello
  • there are too many search results, so I type <c-a>'
  • there are still too many search results, so I type in <c-e> world to get hello' world

In the second example the user has to do a few more keystrokes to jump back and forth between the start and end of the text field, which is a little bit unintuitive and inconvenient

@sudo-nice
Copy link

sudo-nice commented Oct 13, 2018

Looks like this is a desired feature, see #1305 #1265 (comment). To have a command to toggle the exact option would be really helpful.
Currently it's possible to put leading ' to enable exact mode, but if we call fzf with --exact option, it's impossible to toggle that back, I guess.

@CeleritasCelery
Copy link

If using the --exact option, putting ' at the start of the pattern will interpret it as fuzzy. So it works both ways.

@sudo-nice
Copy link

@CeleritasCelery thank you for the tip.

@NightMachinery
Copy link

There is a downside to this; Currently, searching for it' does not interpret ' as magic.

@junegunn A better way is to make a single ' in the query make all the words exact matches. I don't think this would break any current workflows, as a single ' is useless in the current UI. So it's pure upside.

Some examples of what I mean:

  • hi this ' is would become 'hi 'this 'is
  • 'banana is delicious ' would become 'banana 'is 'delicious
  • 'banana ' is delicious would become 'banana 'is 'delicious (the same as previous one)

The meaning would be inverted if --exact is present; A single ' would make all the words fuzzy.

@oOosys
Copy link

oOosys commented Nov 7, 2023

@junegunn A better way is to make a single ' in the query make all the words exact matches. I don't think this would break any current workflows, as a single ' is useless in the current UI. So it's pure upside.

@NightMachinery Just an idea:: using "wrapping" of fzf with an appropriate (expansion) tool replacing typed user input line it should be possible to implement any desired functionality like moving the trailing quotation mark ' to the start of a word or toggle the ' prefix of each word on occurrence of a single ' (surrounded by spaces) in the input. Also a patch extending fzf with an option for such "expansion" of user input should be not very hard to provide.
The advantage of this approach would be that you could for example implement dynamic switching to any expansion mechanism using for example a single occurrence of some self-defined special character without the need to change the core fzf code for parsing user input.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants