-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug: splitting window: oil split could not find parent window #155
Comments
If you use oil and you want to still use netrw, set `default_file_explorer = false`. It is nonsensical to both use netrw _and_ have oil hijack directory buffers (which was the case for the default config). It also causes undefined behavior and bugs. When `default_file_explorer = true` (the default) oil will now disable netrw for you.
This is due to bad interactions with oil and netrw when oil is trying to take over directory buffers but netrw is doing the same. The correct thing to do here is to set require("oil").setup({
default_file_explorer = false
}) Because I've seen these errors before, I've changed the behavior so that when |
if netrw is disabled scp:// ftp:// sftp:// stops working. Is it really the best choice to straight up disable it? |
Fundamentally, if you want oil to work when you do |
I'm pretty sure hijacking worked fine without disabling netrw before and nvim-tree does so aswell but i don't know every edge case. |
@stevearc sorry to bother here, but I think that’s better than open a new issue. I got the same warning today, after opening a file via I have netrw completely disabled and this is my compacted oil config "stevearc/oil.nvim",
keys = {}
cmd = "Oil",
opts = function(_, o)
o.columns = default_coloumns(true)
o.keymaps = {},
o.use_default_keymaps = false
o.silence_scp_warning = true -- disable scp warn to use oil-ssh since I'm using a remap
o.view_options = {}
o.float = {}
o.progress = {}
-- This are defaults for now, no need to override
-- adapters = {
-- ["oil://"] = "file",
-- ["oil-ssh://"] = "ssh",
-- },
-- When opening the parent of a file, substitute these url schemes
-- HACK:
-- https://github.com/stevearc/oil.nvim/blob/931453fc09085c09537295c991c66637869e97e1/lua/oil/config.lua#L102~110
-- Using this to remap url-scheme from args with oil-ssh schemes
o.adapter_aliases = {
["ssh://"] = "oil-ssh://",
["scp://"] = "oil-ssh://",
["sftp://"] = "oil-ssh://",
}
end,
init = function(p)
if vim.fn.argc() == 1 then
local argv = tostring(vim.fn.argv(0))
local stat = vim.loop.fs_stat(argv)
local remote_dir_args = vim.startswith(argv, "ssh") or
vim.startswith(argv, "sftp") or
vim.startswith(argv, "scp")
if stat and stat.type == "directory" or remote_dir_args then
require("lazy").load { plugins = { p.name } }
end
end
if not require("lazy.core.config").plugins[p.name]._.loaded then
vim.api.nvim_create_autocmd("BufNew", {
callback = function()
if vim.fn.isdirectory(vim.fn.expand("<afile>")) == 1 then
require("lazy").load { plugins = { "oil.nvim" } }
-- Once oil is loaded, we can delete this autocmd
return true
end
end,
})
end
end |
@kevinm6 Did you find a fix for it? // the config
return {
"stevearc/oil.nvim",
---@module 'oil'
---@type oil.SetupOpts
opts = {},
-- Optional dependencies
dependencies = { { "echasnovski/mini.icons", opts = {} } },
-- dependencies = { "nvim-tree/nvim-web-devicons" }, -- use if prefer nvim-web-devicons
config = function()
require("oil").setup({
-- just shows all the hidden files
view_options = {
show_hidden = true,
},
default_file_explorer = true
})
vim.keymap.set("n", "<C-n>", "<CMD>Oil<CR>", { desc = "Open parent directory" })
end,
}
|
Did you check the docs and existing issues?
Neovim version (nvim -v)
0.9.0 Release
Operating system/version
Ubuntu 20.04
Describe the bug
Steps To Reproduce
ZZ
to close Lazy.<C-w>v
Expected Behavior
Oil split finds parent window.
Directory structure
No response
Repro
Did you check the bug with a clean config?
nvim -u repro.lua
using the repro.lua file above.The text was updated successfully, but these errors were encountered: