kickstart.nvim/lua/custom/plugins/oil.lua

61 lines
2.0 KiB
Lua

return {
"stevearc/oil.nvim",
config = function()
local oil = require("oil")
oil.setup({
buf_options = {
buflisted = false,
bufhidden = "hide",
},
skip_confirm_for_simple_edits = true,
view_options = {
-- Show files and directories that start with "."
show_hidden = true,
-- This function defines what is considered a "hidden" file
is_hidden_file = function(name, bufnr)
return vim.startswith(name, ".")
end,
-- This function defines what will never be shown, even when `show_hidden` is set
is_always_hidden = function(name, bufnr)
return false
end,
-- Sort file names in a more intuitive order for humans. Is less performant,
-- so you may want to set to false if you work with large directories.
natural_order = true,
-- Sort file and directory names case insensitive
case_insensitive = false,
sort = {
-- sort order can be "asc" or "desc"
-- see :help oil-columns to see which columns are sortable
{ "type", "asc" },
{ "name", "asc" },
},
},
float = {
-- Padding around the floating window
padding = 4,
max_width = 100,
max_height = 15,
border = "rounded",
win_options = {
winblend = 0,
},
-- optionally override the oil buffers window title with custom function: fun(winid: integer): string
get_win_title = nil,
-- preview_split: Split direction: "auto", "left", "right", "above", "below".
preview_split = "auto",
-- This is the config that will be passed to nvim_open_win.
-- Change values here to customize the layout
override = function(conf)
return conf
end,
},
})
vim.keymap.set("n", "-", "<cmd>Oil<cr>", { desc = "Open oil" })
vim.keymap.set("n", "<localleader>-", oil.toggle_float, {})
end,
}