AutoYADM commit: 2024-12-18 16:45:04

This commit is contained in:
Daniel Fichtinger 2024-12-18 16:45:04 -05:00
parent c66cd68dff
commit 24cd695da0
2 changed files with 26 additions and 1 deletions

View file

View file

@ -1,3 +1,14 @@
local detail = false
function _G.get_oil_winbar()
local dir = require("oil").get_current_dir()
if dir then
return vim.fn.fnamemodify(dir, ":~")
else
return vim.api.nvim_buf_get_names(0)
end
end
return {
"stevearc/oil.nvim",
event = "User DirOpened",
@ -10,9 +21,12 @@ return {
delete_to_trash = true,
skip_confirm_for_simple_edits = true,
watch_for_changes = true,
win_options = {
winbar = "%!v:lua.get_oil_winbar()",
},
columns = {
"icon",
"size",
-- "size",
-- TODO:
-- Add a keybind to toggle permissions view?
-- There's a recipe for this in the docs
@ -20,6 +34,17 @@ return {
},
keymaps = {
["<BS>"] = "actions.parent",
["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,
},
},
},
dependencies = { { "echasnovski/mini.icons", opts = {} } },