From 42233458ec19d7bb1996ca367fa6a5c4503d564d Mon Sep 17 00:00:00 2001 From: Fredrik Ekre Date: Wed, 3 Jul 2024 12:25:47 +0200 Subject: [PATCH] [nvim] Configuration for oil.nvim - Enable icons with nvim-web-devicons - Disable some conflicting keymappings - Toggle for detailed view --- .config/nvim/lua/plugins/oil.lua | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/.config/nvim/lua/plugins/oil.lua b/.config/nvim/lua/plugins/oil.lua index 47fff3a..e7810d7 100644 --- a/.config/nvim/lua/plugins/oil.lua +++ b/.config/nvim/lua/plugins/oil.lua @@ -1,17 +1,37 @@ -- https://github.com/stevearc/oil.nvim + +-- For toggling detailed view +local detail = false + return { "stevearc/oil.nvim", + dependencies = { + {"nvim-tree/nvim-web-devicons"}, + }, opts = { columns = { - -- "icon", - -- "permissions", - -- "size", - -- "mtime", + "icon", }, delete_to_trash = true, skip_confirm_for_simple_edits = true, view_options = { show_hidden = true, }, + keymaps = { + -- Disable these since they are used for navigation + [""] = false, + [""] = false, + -- Toggle detailed view with d + ["d"] = { + callback = function() + detail = not detail + local cols = {"icon"} + if detail then + cols = {"icon", "permissions", "size", "mtime"} + end + require("oil").set_columns(cols) + end, + }, + }, }, }