nvim-neo-tree / neo-tree.nvim

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

Fuzzy finder: Force `cursorline` on if not already set #477

Open artempyanykh opened 2 years ago

artempyanykh commented 2 years ago

Either it's the title or I don't understand how to use the fuzzy finder. So, I

  1. open neotree,
  2. hit D,
  3. enter the text, neotree does the filtering,
  4. but then I can not select any folder (neither , or work)

Same with fuzzy file search.

I don't have any keymaps that override C-p, C-n. Do I need some extra configuration?

I installed neo-tree with packer, commit af12b7b041652ecb96cd48603cd62b3ea389fab9

artempyanykh commented 2 years ago

In fact, / do something weird in the input area. 2022-08-10 19 56 24

cseickel commented 2 years ago

I'd say you probably just don't have cursorline enabled, or the highlight is not configured. It may be working as desired you just can't see it.

cseickel commented 2 years ago

I'd say you probably just don't have cursorline enabled, or the highlight is not configured. It may be working as desired you just can't see it.

Now that I am thinking about this, since cursorline is absolutely required for the fuzzy finder to work, maybe the correct thing to do is to check if it is configured when the fuzzy finder opens up and if it is not, either:

A. Temporarily set the cursorline to some middle of the road setting that should work for most themes, then turn it off when the fuzzy find is done. B. Warn the user but make no changes. C. Add an indicator on the left hand indent space to show which line is selected, i.e. -> D. Use the sign column to add a selected row indicator

Does anyone have any opinions on this? C would be the least intrusive but it would require a re-render of the buffer on every selection change. D would be more efficient but also the most complicated because it would require fixing the width calculation for right aligned components.

artempyanykh commented 2 years ago

@cseickel thanks for checking! It was the lack of a highlight for CursorLine in material.nvim. I wouldn't have guessed! Frankly, A is probably fine and intuitive in terms of expected UX as long as it's documented somewhere in the README and configurable.

quackzar commented 1 year ago

This is also a problem if cursorlineopt is set to number as it only highlights the non-existing number column.

loqusion commented 1 year ago

I've also been experiencing this issue, even though I have 'cursorline' set. I can tell the keybinds are working if I manually keep track of where the cursor should be, but there's no visual indicator. I've tried this with multiple color schemes, which all set a bg for CursorLine.

Kapture 2023-04-25 at 00 44 09

kugelest commented 1 year ago

I had the same issue. The problem was, that I had autocmds for only showing cursorline in active window: vim.api.nvim_create_autocmd( { "InsertLeave", "WinEnter" }, { pattern = "*", command = "set cursorline", group = cursorGrp } ) vim.api.nvim_create_autocmd( { "InsertEnter", "WinLeave" }, { pattern = "*", command = "set nocursorline", group = cursorGrp } ) When I remove these autocmds it works.

serranomorante commented 1 year ago

My issue was due to reticle.nvim. I fixed it in this commit

kevinpowell commented 1 year ago

I have the same issue as @loqusion, only I'm using the onenord theme and I have no auto-commands that affect CursorLine. The issue seems to be that the bg color for my Neo-Tree split winds up being the same color as CursorLine. I did some uncouth hacking and made the definition of NeoTreeCursorLine inherit from the global CursorColumn highlight -- now I can see the current row in my NeoTree split all the time, but it's not what I'd call an elegant fix.