neovim/lua/weeheavy/plugins/oil.lua

51 lines
1.6 KiB
Lua

-- File system operations for nerds
-- https://github.com/stevearc/oil.nvim
return {
"stevearc/oil.nvim",
lazy = true,
cmd = "Oil",
config = function()
local detail = false
require("oil").setup({
default_file_explorer = true,
columns = {
-- "size",
"icon",
-- "mtime",
},
view_options = {
show_hidden = true,
},
keymaps = {
-- This should be matched to the open action in remap.lua
["<leader>e"] = "actions.close",
["<C-v>"] = "actions.select_vsplit",
["<C-x>"] = "actions.select_split",
["<C-c>"] = "actions.close",
["q"] = "actions.close",
["<Esc>"] = "actions.close",
["gd"] = {
desc = "Toggle file detail view",
callback = function()
detail = not detail
if detail then
require("oil").set_columns({ "icon", "permissions", "size", "mtime" })
else
require("oil").set_columns({ "icon" })
end
end,
},
},
float = {
-- padding = 4,
max_width = 0.65,
max_height = 0.4,
border = "rounded",
win_options = {
winblend = 0,
},
},
})
end,
}