nvim-neo-tree / neo-tree.nvim

Neovim plugin to manage the file system and other tree like structures.
MIT License
3.87k stars 224 forks source link

Add fuzzy finder behavior to filter functionality #129

Closed cseickel closed 2 years ago

cseickel commented 2 years ago

This is probably related to #116. I find myself naturally wanting to use Up/Down keys when filtering the tree to select files in the search results, and I am annoyed when it doesn't do anything. I am going to change that by adding a "fuzzy finder mode" option which would:

  1. Add mappings to the filter input so that up/down (and C-j/C-k C-p/C-n) move the tree's focused node up and down.
  2. Change the <enter> key behavior so that whatever file is currently focused is opened and the filter is cleared

This makes the functionality closer to what Telescope and other fuzzy finders do.

The big question for anyone that reads this is: Should this just be the new default or should it be a new option that is opted into?

nyngwang commented 2 years ago

FYI: My current way of searching the target quickly is via the filter and the vim-builtin / to search exactly what I want. And this is enough for me. (I also set C-j, C-k to move my cursor faster)

The current problem I found with the existing filter is that:

https://user-images.githubusercontent.com/24765272/152693998-8c5c06b9-9d96-426e-a1f2-a6b2c00af309.mov

cseickel commented 2 years ago

I'm hoping that the new fuzzy finder mode I am about to commit will cut out the second step of using the built in / after using the Neo-tree filter. What I am unsure about is whether most people would prefer this be the new default or if some people liked the way it worked before, where it just filtered and then stayed filtered. My current thinking is that they can use the normal filter command when they want the filter to stick, and only use filter_as_you_type in fuzzy finder mode.

As far as Ctwl-w, the search popup is just a normal buffer and not a terminal, so the usual vim commands apply. If you want C-w to act as a delete word command in insert mode, just add an insert mode mapping. https://stackoverflow.com/questions/32154641/vim-how-to-delete-a-word-in-the-insert-mode

cseickel commented 2 years ago

This has been added to main. I decided to add it as a new command called fuzzy_finder, but make that the default mapping for the / key. hopefully this strikes the right balance between having a better default while not annoying existing users that may have liked the old functionality. At the very least, it's easy to switch back for people that don't like it.