2024-04-10 13:46:15 +02:00
|
|
|
local function save_dir()
|
|
|
|
local dir = require("oil").get_current_dir()
|
|
|
|
if dir ~= nil then
|
2024-04-10 13:17:49 +02:00
|
|
|
local f = io.open("/tmp/oil_dir", "w")
|
|
|
|
if f then
|
2024-04-10 13:46:15 +02:00
|
|
|
f:write(dir)
|
2024-04-10 13:17:49 +02:00
|
|
|
f:close()
|
|
|
|
end
|
2024-04-10 13:46:15 +02:00
|
|
|
end
|
2024-04-10 13:17:49 +02:00
|
|
|
end
|
|
|
|
|
2024-01-17 13:01:32 +01:00
|
|
|
return {
|
|
|
|
'stevearc/oil.nvim',
|
|
|
|
dependencies = { "nvim-tree/nvim-web-devicons" }, lazy = true,
|
|
|
|
opts = {
|
2024-04-29 10:52:06 +02:00
|
|
|
default_file_explorer = true,
|
2024-01-17 13:01:32 +01:00
|
|
|
keymaps = {
|
|
|
|
["g?"] = "actions.show_help",
|
2024-04-10 13:46:15 +02:00
|
|
|
["<CR>"] = function() require("oil").select({}, save_dir) end,
|
2024-01-17 13:01:32 +01:00
|
|
|
["<leader>v"] = "actions.select_vsplit",
|
|
|
|
["<leader>s"] = "actions.select_split",
|
|
|
|
["<leader>p"] = "actions.preview",
|
2024-04-21 21:09:04 +02:00
|
|
|
["<backspace>"] = function() vim.cmd("q!") end,
|
2024-01-17 13:01:32 +01:00
|
|
|
["<leader>r"] = "actions.refresh",
|
2024-04-10 13:46:15 +02:00
|
|
|
["-"] = function() require("oil").open(); save_dir() end,
|
2024-01-17 13:01:32 +01:00
|
|
|
["_"] = "actions.open_cwd",
|
|
|
|
["`"] = "actions.cd",
|
|
|
|
["~"] = "actions.tcd",
|
|
|
|
["g."] = "actions.toggle_hidden",
|
|
|
|
},
|
|
|
|
use_default_keymaps = false,
|
|
|
|
}
|
|
|
|
}
|