tamago324 / lir.nvim

Neovim file explorer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Root dir is not loaded properly when accessing from `lir` buffer

dhruvmanila opened this issue · comments

I have the following action to go to the root dir similar to what you mentioned in the Wiki for going to the home dir:

    ["`"] = function()
      vim.cmd("edit /")
    end,

I tried using the above key binding from both the floating window and the split view and in both cases lir opened a blank buffer, although when I refreshed the buffer using :edit, then it shows me all the entries.

Screen.Recording.2021-05-25.at.11.42.42.mov

I also tried doing :edit / from a normal buffer and that works perfectly. I don't know why this is happening.

Thanks for the report.

I have also reported that issue to neovim. (neovim/neovim#13726)
It is caused by the BufEnter event not happening.
Since I don't know the real cause of the problem, it seems that I have to run doautocmd BufEnter.

Oh, so it only happens when you run it in the lir buffer?
I was mistaken.
I'll check it later.

It may be that vim.cmd('edit /') is not working correctly.

It may be that vim.cmd('edit /') is not working correctly.

Ah, yes this is the cause. I can confirm that the BufEnter autocmd is not being triggered in the case of :lua vim.cmd('edit /'), but is being triggered when doing the same with :edit /

With the workaround mentioned by you (manually triggering the autocmd) solves the issue.

If you want you can close this issue, or else could provide an instruction/warning regarding this type of behavior in the README.

I added it to the docs. (29dbc66)
What do you think?

That's perfect 👍