From dfce2a68c4ee35db892043014636f2d762eb84e2 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 10 Jul 2024 22:16:51 +0100 Subject: [PATCH] home: vim: oil: add detail view toggle mapping --- modules/home/vim/plugin/settings/oil.lua | 25 +++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/modules/home/vim/plugin/settings/oil.lua b/modules/home/vim/plugin/settings/oil.lua index 0dca2f6..2fee1a5 100644 --- a/modules/home/vim/plugin/settings/oil.lua +++ b/modules/home/vim/plugin/settings/oil.lua @@ -1,3 +1,26 @@ local oil = require("oil") +local detail = false -oil.setup() +oil.setup({ + view_options = { + -- Show files and directories that start with "." by default + show_hidden = true, + -- But never '..' + is_always_hidden = function(name, bufnr) + return name == ".." + end, + }, + keymaps = { + ["gd"] = { + desc = "Toggle file detail view", + callback = function() + detail = not detail + if detail then + oil.set_columns({ "icon", "permissions", "size", "mtime" }) + else + oil.set_columns({ "icon" }) + end + end, + }, + }, +})