aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/nvim/.config/nvim/lua/plugins/oil.lua
diff options
context:
space:
mode:
Diffstat (limited to 'nvim/.config/nvim/lua/plugins/oil.lua')
-rw-r--r--nvim/.config/nvim/lua/plugins/oil.lua30
1 files changed, 30 insertions, 0 deletions
diff --git a/nvim/.config/nvim/lua/plugins/oil.lua b/nvim/.config/nvim/lua/plugins/oil.lua
new file mode 100644
index 0000000..ff48f6c
--- /dev/null
+++ b/nvim/.config/nvim/lua/plugins/oil.lua
@@ -0,0 +1,30 @@
+---@diagnostic disable: param-type-mismatch
+---@type LazyPluginSpec
+local M = {
+ "stevearc/oil.nvim",
+ version = "*",
+ cmd = { "Oil", "BufNew" },
+ keys = {
+ "-",
+ },
+ opts = {
+ default_file_explorer = true,
+ skip_confirm_for_simple_edits = true,
+ },
+}
+
+function M:init()
+ vim.keymap.set("n", "-", function()
+ return require("oil").open()
+ end, { desc = "Open parent directory" })
+
+ if vim.fn.argc() == 1 then
+ local stat = vim.loop.fs_stat(vim.fn.argv(0))
+ local adapter = string.match(vim.fn.argv(0), "^([%l-]*)://")
+ if (stat and stat.type == "directory") or adapter == "oil-ssh" then
+ require("lazy").load({ plugins = { "oil.nvim" } })
+ end
+ end
+end
+
+return M