snailed
/
taolf
Archived
2
0
Fork 0

fix(16): add new file to arglist

This commit is contained in:
Lucas Burns 2023-08-09 15:55:38 -05:00
parent b76c29dd5f
commit 5c1d8569d3
No known key found for this signature in database
GPG Key ID: C011CBEF6628B679
1 changed files with 7 additions and 1 deletions

View File

@ -32,6 +32,7 @@ local Terminal = require("toggleterm.terminal").Terminal
---@field tmp_lastdir string Path to a file containing the last directory `lf` was in
---@field id number? Current `lf` session id
---@field bufnr number The open file's buffer number
---@field arglist string[] The argument list to neovim
---@field action string The current action to open the file
---@field signcolumn string The signcolumn set by the user before the terminal buffer overrides it
local Lf = {}
@ -72,6 +73,7 @@ function Lf:new(config)
end
self.bufnr = 0
self.arglist = fn.argv()
self.view_idx = 1
self.action = self.cfg.default_action
-- Needs to be grabbed here before the terminal buffer is created
@ -269,7 +271,11 @@ function Lf:__callback(term)
for fname in io.lines(self.tmp_sel) do
local stat = uv.fs_stat(fname)
if type(stat) == "table" then
cmd(("%s %s"):format(self.action, fn.fnameescape(fname)))
local fesc = fn.fnameescape(fname)
cmd(("%s %s"):format(self.action, fesc))
cmd.argadd(table.concat(self.arglist, " "))
self.arglist = fn.argv()
cmd.argdedupe()
end
end
end