dotfiles/.config/nvim/lua/plugins/oil.lua

33 lines
1.0 KiB
Lua
Raw Normal View History

2024-04-10 13:46:15 +02:00
local function save_dir()
local dir = require("oil").get_current_dir()
if dir ~= nil then
local f = io.open("/tmp/oil_dir", "w")
if f then
2024-04-10 13:46:15 +02:00
f:write(dir)
f:close()
end
2024-04-10 13:46:15 +02:00
end
end
2024-01-17 13:01:32 +01:00
return {
'stevearc/oil.nvim',
dependencies = { "nvim-tree/nvim-web-devicons" }, lazy = true,
opts = {
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,
}
}