-
-
Notifications
You must be signed in to change notification settings - Fork 46
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] restore from path argument incompatible with oil.nvim #372
Comments
I use oil as well and I think the trick is to make sure it's lazy loaded until after the session is restored. What does your oil config look like? For mine, i set return {
'stevearc/oil.nvim',
keys = {
{
'<Bslash><Bslash>',
function() require('oil').toggle_float() end,
desc = 'Oil popup',
},
},
... |
return {
"stevearc/oil.nvim",
opts = {},
dependencies = { "nvim-tree/nvim-web-devicons" },
config = function()
require("oil").setup({
default_file_explorer = true,
delete_to_trash = true,
skip_confirm_for_simple_edits = false,
view_options = {
show_hidden = false,
natural_order = true,
is_always_hidden = function(name, _)
return name == '..' or name == '.git'
end,
},
win_options = {
wrap = true,
}
})
end,
} its probably due to |
Shouldn't depend on Or you can try my config: return {
'stevearc/oil.nvim',
keys = {
{
'<Bslash><Bslash>',
function() require('oil').toggle_float() end,
desc = 'Oil',
},
},
opts = {
default_file_explorer = true,
delete_to_trash = true,
skip_confirm_for_simple_edits = false,
view_options = {
show_hidden = true,
natural_order = true,
is_always_hidden = function(name, _) return name == '..' or name == '.git' end,
},
float = {
padding = 2,
max_width = 90,
max_height = 0,
},
win_options = {
wrap = true,
winblend = 0,
},
keymaps = {
['<C-c>'] = false,
['q'] = 'actions.close',
['<Esc>'] = 'actions.close',
},
},
} With the |
@niderhoff are you still running into problems or did this resolve it for you? |
I tried again and now it behaves like this (without errors):
it is what I would expected it to behave, but maybe we should update readme to indicate that if something hooks into default_file_explorer (such as oil, or neotree) it might mean that behaviour 2:
will instead open the file explorer. |
I'll take a look at the docs and see if I can clarify a bit. If you want return {
"stevearc/oil.nvim",
-- setting cmd/keys will cause Lazy.nvim to only load Oil when on that cmd or key press
cmd = 'Oil',
keys = {
{
'<Bslash><Bslash>', -- or whatever key you want to trigger oil
function() require('oil').toggle_float() end, -- or however you want it to be displayed
desc = 'Oil',
},
},
-- opts = {}, -- setting opts doesn't do anything if you're using a custom config function so this line can be removed
dependencies = { "nvim-tree/nvim-web-devicons" },
config = function()
require("oil").setup({
default_file_explorer = true,
delete_to_trash = true,
skip_confirm_for_simple_edits = false,
view_options = {
show_hidden = false,
natural_order = true,
is_always_hidden = function(name, _)
return name == '..' or name == '.git'
end,
},
win_options = {
wrap = true,
}
})
end,
} If you want oil to load for a directory if there's no existing session, you could also add this to your auto-session config: return {
'rmagatti/auto-session',
lazy = false,
...
---@module "auto-session"
---@type AutoSession.Config
opts = {
...
no_restore_cmds = {
function()
-- load oil in case we're launching with a dir arg and there's no session
require('oil')
end,
},
},
}
|
Describe the bug
Trying to restore a session from a path argument like this:
will fail, because it is compatible, with
oil.nvim
, because the latter is rewriting the argument from/my_folder/
tooil:///my_folder
.To Reproduce
Steps to reproduce the behavior:
/my_folder
oil.nvim
nvim /my_folder/
oil
file explorer is startedExpected behavior
Session is restored.
Screenshots
Before
oil.nvim
:after:
Checkhealth
Baseline (please complete the following information):
Additional context
The text was updated successfully, but these errors were encountered: