Code Monkey home page Code Monkey logo

Comments (4)

urbainvaes avatar urbainvaes commented on May 23, 2024

Hi,

Many thanks for the feedback. In my configuration I define

# You will need to change the first line
FZF_MARKS_PLUGIN_ZSH=$HOME/dotfiles/plugins/fzf-marks/fzf-marks.plugin.zsh
source "$FZF_MARKS_PLUGIN_ZSH"
FZF_MARKS_COMMAND="$FZF_MARKS_COMMAND -e -n 1'"

The option -e enables exact matching, and the option -1 enables auto-accept when there is only one match. Might this solve your issue?

from fzf-marks.

erikw avatar erikw commented on May 23, 2024

Thank you for the suggestion.

Hmm

FZF_MARKS_COMMAND="$FZF_MARKS_COMMAND -e -n 1'"

is not valid because the single quote before the last double quote. I would assume that you mean

FZF_MARKS_COMMAND="$FZF_MARKS_COMMAND -e -n -1'"

I'm not sure what the the -nis supposed to do. From the fzf manual I see

-1, --select-1
                If there is only one match for the initial query (--query), do not start interactive finder and automatically select the only match
[...]
        -n, --nth=N[,..]
                Comma-separated list of field index expressions for limiting search scope.  See FIELD INDEX EXPRESSION for the details.
[...]
 FIELD INDEX EXPRESSION
         A field index expression can be a non-zero integer or a range expression ([BEGIN]..[END]). --nth and --with-nth take a comma-separated list of field index expressions.


     Examples
         1      The 1st field
         2      The 2nd field
         -1     The last field

When using this FZF_MARKS_COMMAND above,

  • Bookmarks are not found at all
  • They are actually being deleted from the marks file after failed lookup (!!). I needed to add my bookmarks back many times trying this out.
    • Turns out that I usually do ctrl+d to close/discard fzf selection. However in fzf-marks, ctrl+d means delete mark. Is there a way to change this to another key combination? :P It would be nice if fzf selection window consistently as usual.

However if I remove the -n to make it

FZF_MARKS_COMMAND="$FZF_MARKS_COMMAND -e -1'"

it works slightly better. With this, jump is done directly to exact match, but only if there are no other matches.

E.g. with marks abc, def, defg

$ fzm abc   # Jumps directly to destination of abc
$ fzm def   # shows fzf selection window with result def & defg. However is exact match and should jump to def destination directly!

Edit.

I figured that you maybe meant

FZF_MARKS_COMMAND="$FZF_MARKS_COMMAND -e -n 1 -1"

which with spelled out long-names is

FZF_MARKS_COMMAND="$FZF_MARKS_COMMAND --exact --nth=1 --select-1"

However the behavior is still the same that an initial query for an exact bookmark def still shows selection window for def & defg instead of going to def directly

from fzf-marks.

urbainvaes avatar urbainvaes commented on May 23, 2024

Hi,

Sorry, I responded a little bit too fast. It is indeed the -1 flag, which is enabled by default in the code of the plugin, that is responsible for the "auto-accept on exact match" behavior.

I also understand your issue better: you would like the plugin to auto-accept on exact match even if the initial query is an exact substring of one of the other marks. It's not unreasonable, and I'll take a look at this when I get the time.

Turns out that I usually do ctrl+d to close/discard fzf selection. However in fzf-marks, ctrl+d means delete mark. Is there a way to change this to another key combination? :P It would be nice if fzf selection window consistently as usual.

Yes, just set FZF_MARKS_DELETE to the key you want to use.

from fzf-marks.

erikw avatar erikw commented on May 23, 2024

you would like the plugin to auto-accept on exact match even if the initial query is an exact substring of one of the other marks. It's not unreasonable, and I'll take a look at this when I get the time.

Exactly! :). As maybe not everyone would like this behavior, I think it could be an opt-in e.g. FZF_MARKS_JUMP_EXACT_MATCH=true

Yes, just set FZF_MARKS_DELETE to the key you want to use.

Just perfect. Now I can continue using ctrl+d consistently in all fzf-plugins. Thanks!

from fzf-marks.

Related Issues (19)

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.