summaryrefslogtreecommitdiff
path: root/lua/bee/plugins/oil.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua/bee/plugins/oil.lua')
-rw-r--r--lua/bee/plugins/oil.lua72
1 files changed, 72 insertions, 0 deletions
diff --git a/lua/bee/plugins/oil.lua b/lua/bee/plugins/oil.lua
new file mode 100644
index 0000000..5f8c6d6
--- /dev/null
+++ b/lua/bee/plugins/oil.lua
@@ -0,0 +1,72 @@
+return {
+ {
+ "oil.nvim",
+ lazy = true,
+ keys = { { "<leader>o", "<CMD>Oil<CR>", desc = "Open oil" } },
+ auto_enable = true,
+ after = function()
+ vim.g.loaded_netrwPlugin = 1
+ vim.keymap.set("n", "<leader>o", "<cmd>Oil .<CR>", { noremap = true, desc = "Open nvim root directory" })
+ require("oil").setup({
+ keymaps = {
+ ["-"] = "actions.parent",
+ ["<CR>"] = "actions.select",
+ ["<C-v>"] = "actions.select_vsplit",
+ ["<C-s>"] = "actions.select_split",
+ },
+ vim.keymap.set("n", "<leader>o", "<cmd>Oil<cr>", { desc = "Open Oil" }),
+
+ -- Oil will take over directory buffers (e.g. `vim .` or `:e src/`)
+ -- Set to false if you still want to use netrw.
+ default_file_explorer = true,
+ -- Id is automatically added at the beginning, and name at the end
+ -- See :help oil-columns
+ columns = {
+ "icon",
+ "permissions",
+ "size",
+ -- "mtime",
+ },
+ -- Buffer-local options to use for oil buffers
+ buf_options = {
+ buflisted = false,
+ bufhidden = "hide",
+ },
+ -- Window-local options to use for oil buffers
+ win_options = {
+ wrap = false,
+ signcolumn = "no",
+ cursorcolumn = false,
+ foldcolumn = "0",
+ spell = false,
+ list = false,
+ conceallevel = 3,
+ concealcursor = "nvic",
+ },
+ -- Send deleted files to the trash instead of permanently deleting them (:help oil-trash)
+ delete_to_trash = false,
+ -- Skip the confirmation popup for simple operations (:help oil.skip_confirm_for_simple_edits)
+ skip_confirm_for_simple_edits = false,
+ -- Selecting a new/moved/renamed file or directory will prompt you to save changes first
+ -- (:help prompt_save_on_select_new_entry)
+ prompt_save_on_select_new_entry = true,
+ -- Oil will automatically delete hidden buffers after this delay
+ -- You can set the delay to false to disable cleanup entirely
+ -- Note that the cleanup process only starts when none of the oil buffers are currently displayed
+ cleanup_delay_ms = 2000,
+ lsp_file_methods = {
+ -- Time to wait for LSP file operations to complete before skipping
+ timeout_ms = 1000,
+ -- Set to true to autosave buffers that are updated with LSP willRenameFiles
+ -- Set to "unmodified" to only save unmodified buffers
+ autosave_changes = false,
+ },
+ -- Constrain the cursor to the editable parts of the oil buffer
+ -- Set to `false` to disable, or "name" to keep it on the file names
+ constrain_cursor = "editable",
+ -- Set to true to watch the filesystem for changes and reload oil
+ experimental_watch_for_changes = false,
+ })
+ end,
+ },
+}