Skip to content

Commit

Permalink
fix: error when opening files from floating oil window (#355)
Browse files Browse the repository at this point in the history
  • Loading branch information
stevearc committed Apr 21, 2024
1 parent 1f05774 commit 2bc56ad
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lua/oil/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down

0 comments on commit 2bc56ad

Please sign in to comment.