bfrg / vim-fzy

Run fzy asynchronously in a Vim (popup) terminal-window
13 stars 1 forks source link

[feature request] Have keybindings to chose where to put selected entry #8

Open saccarosium opened 6 days ago

saccarosium commented 6 days ago

Hi, I've been really enjoying the plugin. Fzy is much better than fzf in terms of quality of matches. But I've been missing a lot fzf.vim feature to just press CTRL_V to put the selected item into a vertical split.

I'm aware of FzyFindSplit but, IMO, puts some mental overhead since I don't necessarily know if I want to split or not before I made the search. My mind simply doesn't work like that.

I would be happy to make the feature myself if you are cool with it.

bfrg commented 6 days ago

I actually wanted to implement this in the past but somehow got used to just pressing the right key mappings before opening the fuzzy finder. For example, I have <Space>fe, <Space>fs, <Space>fv and <Space>ft for finding files under current directory and opening the selected file in the current window, new horizontal split, vertical split or tab page, respectively. I have similar mappings for opening buffers, help pages, tags etc. That's why I never implemented it. Nevertheless, I am open to adding this feature :smile:.

Implementing it will be a little bit tricky since there's no way to configure fzy key bindings, so we're left with using tnoremap in the terminal buffer with term_sendkeys(fzybufnr, "\<Cr>").

Fzy is much better than fzf in terms of quality of matches.

That's interesting. I haven't compared their matching/scoring algorithms so far. Can you give an example where fzy works better than fzf?

I was actually considering switching back to fzf because there hasn't been any movement in the fzy repository in over 4 years. There are a few bugs and the author doesn't even bother replying to the issuer or PRs. For example, when the terminal window is vertically resized, fzy won't redraw its screen properly. For that reason, I need to check if the --show-info option has been passed to fzy and then set Vim's terminal window to the correct height before opening fzy. Otherwise fzy's input prompt is messed up. fzf works much better in this regard. Not to mention that it provides some very useful features.

saccarosium commented 6 days ago

Can you give an example where fzy works better than fzf?

I don't really have a concrete example on top of my head. I know that, in my experience, usually fzy is far better in matching something I already know the name (witch is my most frequent situation). Fzf on the other hand is best when I'm searching for something that I don't know the name. I think this is due to fzf matching more sparsely in the string and fzy more rigidly.

I was actually considering switching back to fzf because there hasn't been any movement in the fzy repository in over 4 years. There are a few bugs and the author doesn't even bother replying to the issuer or PRs.

Yes, this is the biggest deal breaker. For this reason I was thinking on making a fork compatible with fzy. I'm just too busy right know but at some point I probably will do it.