diff --git a/README.md b/README.md index b3bf707..63b06b4 100644 --- a/README.md +++ b/README.md @@ -132,6 +132,8 @@ require("oil").setup({ conceallevel = 3, concealcursor = "n", }, + -- Oil will take over directory buffers (e.g. `vim .` or `:e src/` + default_file_explorer = true, -- Restore window options to previous values when leaving an oil buffer restore_win_options = true, -- Skip the confirmation popup for simple operations diff --git a/doc/oil.txt b/doc/oil.txt index dc2f8e2..22c4fc0 100644 --- a/doc/oil.txt +++ b/doc/oil.txt @@ -37,6 +37,8 @@ OPTIONS *oil-option conceallevel = 3, concealcursor = "n", }, + -- Oil will take over directory buffers (e.g. `vim .` or `:e src/` + default_file_explorer = true, -- Restore window options to previous values when leaving an oil buffer restore_win_options = true, -- Skip the confirmation popup for simple operations diff --git a/lua/oil/config.lua b/lua/oil/config.lua index 8e869ee..b11c641 100644 --- a/lua/oil/config.lua +++ b/lua/oil/config.lua @@ -22,6 +22,8 @@ local default_config = { conceallevel = 3, concealcursor = "n", }, + -- Oil will take over directory buffers (e.g. `vim .` or `:e src/` + default_file_explorer = true, -- Restore window options to previous values when leaving an oil buffer restore_win_options = true, -- Skip the confirmation popup for simple operations diff --git a/lua/oil/init.lua b/lua/oil/init.lua index 4fa1ec7..c937d3d 100644 --- a/lua/oil/init.lua +++ b/lua/oil/init.lua @@ -459,6 +459,9 @@ end local function maybe_hijack_directory_buffer(bufnr) local config = require("oil.config") local util = require("oil.util") + if not config.default_file_explorer then + return + end local bufname = vim.api.nvim_buf_get_name(bufnr) if bufname == "" then return