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

33 lines
1013 B
Lua

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
f:write(dir)
f:close()
end
end
end
return {
'stevearc/oil.nvim',
dependencies = { "nvim-tree/nvim-web-devicons" }, lazy = true,
opts = {
keymaps = {
["g?"] = "actions.show_help",
["<CR>"] = function() require("oil").select({}, save_dir) end,
["<leader>v"] = "actions.select_vsplit",
["<leader>s"] = "actions.select_split",
["<leader>p"] = "actions.preview",
["<backspace>"] = "actions.close",
["<leader>r"] = "actions.refresh",
["-"] = function() require("oil").open(); save_dir() end,
["_"] = "actions.open_cwd",
["`"] = "actions.cd",
["~"] = "actions.tcd",
["g."] = "actions.toggle_hidden",
},
use_default_keymaps = false,
}
}