Cannot open lf after renaming the currently open file
mhdna opened this issue · comments
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>
This error also occurs if you delete the file. The working solution is to manually unload the buffer. lf
should behave normally afterwards.
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?
@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?