Skip to content

Commit

Permalink
feat: config option to disable directory hijacking (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
stevearc committed Mar 18, 2023
1 parent 57451c5 commit 3d3df74
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions doc/oil.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions lua/oil/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions lua/oil/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3d3df74

Please sign in to comment.