ray-x / navigator.lua

Code analysis & navigation plugin for Neovim. Navigate codes like a breeze🎐 Exploring LSP and 🌲Treesitter symbols a piece of 🍰 Take control like a boss 🦍
MIT License
1.29k stars 58 forks source link

[Feature] Prevent fzy search #291

Closed hjkatz closed 10 months ago

hjkatz commented 11 months ago

Is there a way to prevent the fzy search from happening by default when opening references (and other functions) for large lists? I notice that the behaviour seems to change when there are ~5 references found (then I can immediately start using j/k to move up/down) vs. when there are ~15 references (then I just start filtering for "jjjjjjj"... which is no fun).

What I would like is:

I wasn't able to find where/how this behaviour was being set in the code with a quick read.

hjkatz commented 11 months ago

This might be an insert vs. normal mode thing. Maybe the default mode is insert when the number of list items is greater than some threshold...?

ray-x commented 11 months ago

You are right, It is in Insertmode when the listed items are more than a page. You can simplify change back to Nomal mode when you need to move up/down. Or use imap to move up/down e.g. <C-n> and <C-p> or <Up> and <Down>

hjkatz commented 11 months ago

Can I change the threshold of "when the listed items are more than a page"?

I always want to open up guihua windows in Normal mode.

ray-x commented 10 months ago

I added a new option to the config prompt_mode = 'insert', -- 'normal' | 'insert'

hjkatz commented 10 months ago

I updated locally and didn't see the changes work as expected.

So I manually changed this diff in my local plugin's code:

    opts.transparency = config.transparency
    if #items >= config.lines_show_prompt then
      opts.prompt = true
      opts.enter = _NgConfigValues.prompt_mode == 'insert'
    end

+   opts.prompt = true
+   opts.enter = false
+

and still I see the prompt mode starting in insert mode.

ray-x commented 10 months ago

Yes. you are right. There are another piece been missing. I updated the code and run some tests and it should work now

hjkatz commented 10 months ago

Great! Looks like everything is working now :)