lmburns / lf.nvim

Lf file manager for Neovim (in Lua)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unexpected reset of arglist when opening file from LF

mroavi opened this issue · comments

Issue Description:

Upon opening a file from LF, the arglist unexpectedly resets to only contain the opened file's name, disregarding any previous entries.

Steps to Reproduce:

  1. Create two test files, one.md and two.md, using the command:
touch one.md two.md
  1. Open one.md with Neovim:
nvim one.md
  1. Within Neovim, run the command :arg which outputs [one.md].

  2. Open LF using the :Lf command.

  3. With LF open, highlight two.md and press enter to open it.

  4. Now run :arg command again. This outputs [/home/mroavi/lf-bug/two.md], meaning the arglist has been reset to contain only two.md.

Problem:

This behavior of resetting the arglist to contain only the newly opened file from LF becomes problematic for users who rely on the arglist for various purposes. Ideally, the arglist should retain its previous entries and add any new file opened from LF, rather than completely resetting.

This bug was introduced in ffcacf5

All you have to do is change your default command from drop to argedit.

I added a keybinding for it in the latest commit. It is <C-g>.

Do note that that I was able to get both of the filenames in the argument list by using the function vim.fn.argv().

Editing to say that it should now work just fine with :arg.