cloudhead / neovim-fuzzy

Minimalistic fuzzy file finding for neovim
BSD 3-Clause "New" or "Revised" License
111 stars 17 forks source link

After `:tab drop file.js` into neovim from empty buffer `:FuzzyOpen` acts differently in this buffer #18

Closed insidewhy closed 7 years ago

insidewhy commented 7 years ago
:tab drop file

In this buffer when you run :FuzzyOpen it matches on filenames in open buffers, not all the files in git. If you switch to any other buffer it will behave normally, but switch back to the "bugged" buffer and it won't work.

However if you :tab drop from a buffer with an open file then :FuzzyOpen will work fine.

Could be a bug with neovim.

insidewhy commented 7 years ago

So essentially:

:tabnew
:tab drop file

Leads to a bugged file buffer (since the tabnew means it happens from an empty buffer). But:

:edit file1
:tab drop file2

Everything is fine.

insidewhy commented 7 years ago

Using vim-node's gf feature on any source file causes this state to occur on every buffer.

insidewhy commented 7 years ago

I've found the condition that makes it bug out:

https://github.com/cloudhead/neovim-fuzzy/blob/master/plugin/neovim-fuzzy.vim#L148

On that line the first entry in the array is an empty string, whenever that condition occurs the bugged behaviour happens.

insidewhy commented 7 years ago

https://github.com/cloudhead/neovim-fuzzy/blob/master/plugin/neovim-fuzzy.vim#L144

This line here is where the empty string gets added to ignorelist.

insidewhy commented 7 years ago

Okay it all makes sense now, bufname('#') gets the name of the "alternate buffer", the last buffer used. When using tab drop and gf sometimes this can end up being an empty name. Need to make sure the string isn't empty before appending it to that array. Easy PR.