Skip to content

Commit 2bc56ad

Browse files
committed
fix: error when opening files from floating oil window (#355)
1 parent 1f05774 commit 2bc56ad

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lua/oil/init.lua

+2-1
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,7 @@ M.select = function(opts, callback)
640640
end
641641

642642
local prev_win = vim.api.nvim_get_current_win()
643+
local oil_bufnr = vim.api.nvim_get_current_buf()
643644

644645
-- Async iter over entries so we can normalize the url before opening
645646
local i = 1
@@ -665,7 +666,7 @@ M.select = function(opts, callback)
665666

666667
-- Normalize the url before opening to prevent needing to rename them inside the BufReadCmd
667668
-- Renaming buffers during opening can lead to missed autocmds
668-
util.get_edit_path(0, entry, function(normalized_url)
669+
util.get_edit_path(oil_bufnr, entry, function(normalized_url)
669670
local mods = {
670671
vertical = opts.vertical,
671672
horizontal = opts.horizontal,

0 commit comments

Comments
 (0)