fix: window options sometimes not set in oil buffer (#287)
This commit is contained in:
parent
f259347d4d
commit
17d71eb3d8
1 changed files with 4 additions and 5 deletions
|
|
@ -1082,17 +1082,16 @@ M.setup = function(opts)
|
||||||
local bufname = vim.api.nvim_buf_get_name(0)
|
local bufname = vim.api.nvim_buf_get_name(0)
|
||||||
local scheme = util.parse_url(bufname)
|
local scheme = util.parse_url(bufname)
|
||||||
if scheme and config.adapters[scheme] then
|
if scheme and config.adapters[scheme] then
|
||||||
require("oil.view").maybe_set_cursor()
|
local view = require("oil.view")
|
||||||
|
view.maybe_set_cursor()
|
||||||
-- While we are in an oil buffer, set the alternate file to the buffer we were in prior to
|
-- While we are in an oil buffer, set the alternate file to the buffer we were in prior to
|
||||||
-- opening oil
|
-- opening oil
|
||||||
local has_orig, orig_buffer = pcall(vim.api.nvim_win_get_var, 0, "oil_original_buffer")
|
local has_orig, orig_buffer = pcall(vim.api.nvim_win_get_var, 0, "oil_original_buffer")
|
||||||
if has_orig and vim.api.nvim_buf_is_valid(orig_buffer) then
|
if has_orig and vim.api.nvim_buf_is_valid(orig_buffer) then
|
||||||
vim.fn.setreg("#", orig_buffer)
|
vim.fn.setreg("#", orig_buffer)
|
||||||
end
|
end
|
||||||
if not vim.w.oil_did_enter then
|
view.set_win_options()
|
||||||
require("oil.view").set_win_options()
|
vim.w.oil_did_enter = true
|
||||||
vim.w.oil_did_enter = true
|
|
||||||
end
|
|
||||||
elseif vim.fn.isdirectory(bufname) == 0 then
|
elseif vim.fn.isdirectory(bufname) == 0 then
|
||||||
-- Only run this logic if we are *not* in an oil buffer (and it's not a directory, which
|
-- Only run this logic if we are *not* in an oil buffer (and it's not a directory, which
|
||||||
-- will be replaced by an oil:// url)
|
-- will be replaced by an oil:// url)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue