fix: error when opening files from floating oil window (#355)

This commit is contained in:
Steven Arcangeli 2024-04-21 07:37:54 -07:00
parent 1f05774e1c
commit 2bc56ad68a

View file

@ -640,6 +640,7 @@ M.select = function(opts, callback)
end
local prev_win = vim.api.nvim_get_current_win()
local oil_bufnr = vim.api.nvim_get_current_buf()
-- Async iter over entries so we can normalize the url before opening
local i = 1
@ -665,7 +666,7 @@ M.select = function(opts, callback)
-- Normalize the url before opening to prevent needing to rename them inside the BufReadCmd
-- Renaming buffers during opening can lead to missed autocmds
util.get_edit_path(0, entry, function(normalized_url)
util.get_edit_path(oil_bufnr, entry, function(normalized_url)
local mods = {
vertical = opts.vertical,
horizontal = opts.horizontal,