ibhagwan / fzf-lua

Improved fzf.vim written in lua
MIT License
2.33k stars 150 forks source link

[Feature] start in normal mode when opening fzf window #997

Closed 64-bitman closed 10 months ago

64-bitman commented 10 months ago

I mostly use this plugin to switch between buffers, and sometimes I move up and down through the list using key binds instead of directly fuzzy searching. its just faster visually seeing the buffer name sometimes instead of thinking what the buffer name is again, especially when I'm opening buffers quickly.

Problem is that moving through the buffers using key binds is quite awkward (I have mines set to 'A-k' and 'A-j', and I usually forget to press the modifier key). Its also more convenient to be able to toggle fzf-lua with just a single key bind, instead of having one bind to open and another to close it.

Could there possibly be an option to start in a mode where you can just move up and down with the traditional movement keys and select/open, and go into fuzzy searching mode by pressing a key?

Thanks,

ibhagwan commented 10 months ago

I don’t really see the benefit here, since fzf-lua is a terminal window you’d still need to go into insert mode then write the buffer name and press enter to select (unlike Telescope, navigating in normal mode won’t change the fzf selection).

If you really want to try that I think you can use the on_create event to send keys to enter normal mode (search the issues/docs/default opts for on_create).

64-bitman commented 10 months ago

I don’t really see the benefit here, since fzf-lua is a terminal window you’d still need to go into insert mode then write the buffer name and press enter to select.

If you really want to try that I think you can use the on_create event to send keys to enter normal mode (search the issues/docs/default opts for on_create).

What I mean is something like this: look at demo.mp4, is something similar to that possible? Something like moving your cursor the the line where the buffer/file/option is, and then pressing enter to open and edit that buffer or thing normally. I know this plugin is supposed to be a fuzzy searcher, but an option like that would be nice.

ibhagwan commented 10 months ago

I don’t really see the benefit here, since fzf-lua is a terminal window you’d still need to go into insert mode then write the buffer name and press enter to select. If you really want to try that I think you can use the on_create event to send keys to enter normal mode (search the issues/docs/default opts for on_create).

What I mean is something like this: look at demo.mp4, is something similar to that possible? Something like moving your cursor the the line where the buffer/file/option is, and then pressing enter to open and edit that buffer or thing normally. I know this plugin is supposed to be a fuzzy searcher, but an option like that would be nice.

Unfortuntaely that's not possible, the main fzf window is a terminal window and the selected item has nothing to do with the cursor in normal mode, try it out, use <c-\><c-n> to exit to normal mode and move the cursor, once you enter insert mode again the selection is still where it was before (due to the inner buffer being a temrinal).

Perhaps you can remap enter in normal mode to copy the buffer name and then paste it into the fuzzy search upon entering insert mode so you can press enter to select the buffer but that's what I mean by "hacky" - not something I intend to add/support.

64-bitman commented 10 months ago

I see, thank you for answering though.