Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot open lf after renaming the currently open file #24

Open
mhdna opened this issue Sep 9, 2023 · 4 comments
Open

Cannot open lf after renaming the currently open file #24

mhdna opened this issue Sep 9, 2023 · 4 comments

Comments

@mhdna
Copy link

mhdna commented Sep 9, 2023

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
Copy link

dhzip commented Oct 21, 2023

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

tanloong added a commit to tanloong/lf.nvim that referenced this issue Jan 3, 2024
@tanloong
Copy link

tanloong commented Jan 3, 2024

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@ffd7e71

@dylan-chong
Copy link

@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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants