lmburns / lf.nvim

Lf file manager for Neovim (in Lua)
MIT License
98 stars 12 forks source link

Cannot open lf after renaming the currently open file #24

Open mhdna opened 1 year ago

mhdna commented 1 year ago

If you try renaming the currently open file then start lf, this error message shows up and you'll never be able to open lf afterwards unless you restart Neovim, even if you switch to the newly created file or to other buffers:

Error executing Lua callback: /home/mahdi/.local/share/nvim/lazy/lf.nvim/lua/lf/main.lua:299: wrong number of arguments to 'insert'           
stack traceback:
        [C]: in function 'insert'
        /home/mahdi/.local/share/nvim/lazy/lf.nvim/lua/lf/main.lua:299: in function '__set_argv'
        /home/mahdi/.local/share/nvim/lazy/lf.nvim/lua/lf/main.lua:75: in function 'new'
        /home/mahdi/.local/share/nvim/lazy/lf.nvim/lua/lf.lua:127: in function 'start'
        /home/mahdi/.local/share/nvim/lazy/lf.nvim/lua/lf.lua:37: in function </home/mahdi/.local/share/nvim/lazy/lf.nvim/lua/lf.lua:36>
dhzip commented 1 year ago

This error also occurs if you delete the file. The working solution is to manually unload the buffer. lf should behave normally afterwards.

tanloong commented 10 months ago

I made a little change to the code, and it seems to resolve the problem. However, I am not sure whether this change will introduce any new unknown issues.

Hi @lmburns , do you have some time to take a look at the change?

https://github.com/tanloong/lf.nvim/commit/ffd7e71fb090068931df50993e686140622995ec

dylan-chong commented 8 months ago

@tanloong Wouldn't it make more sense to do a check around this line https://github.com/tanloong/lf.nvim/blob/ffd7e71fb090068931df50993e686140622995ec/lua/lf/main.lua#L157

What happens if you replace curfile with null?

dylan-chong commented 4 months ago

Is anyone able to fix this? This is a very annoying bug